In the simple solution to a single resource monitor solution, which of the following problems are possible (mark as many as applicable)?
monitor ResourceAllocator
{
boolean busy;
condition x;
void acquire(int time) {
if (busy)
x.wait(time);
busy = true;
}
void release() {
busy = false;
x.signal();
}
initialization code() {
busy = false;
}
}
Figure 5.19 A monitor to allocate a single resource
1 A process might attempt to release a resource that it never requested
2 A process might request the same resource twice (without first releasing the resource).
3 A process might never release a resource once it has been granted access to the resource.
4 A process might access a resource without first gaining access permission to the resource.