2,313 views
3 votes
3 votes
var occupied
var blocked
Enter Region:
{
If (occupied) {
then blocked= blocked +1
sleep ( );
}
else occupied= 1;
}
Exit Region:
{
occupied= 0
If (blocked) {
then wakeup (process);
blocked= blocked – 1;
}
}

True/False
(1) Mutual Exclusion is guaranteed?
(2) Deadlock free Algorithm?
(3) Progress is guaranteed?

3 Answers

Best answer
7 votes
7 votes
The mutual exclusion not guaranteed as it can context switch at else statement of entry section and both process can enter the CS

Mutual exclusion not satisfied so deadlock free.

Progress is satisfied because entry of the process is only decided by the processes willing to enter critical section. because occupied can be made 0. as soon as process completes
selected by
2 votes
2 votes

As per theory, we can say that if there is no mutual exclusion then it is deadlock free algorithm. But in this problem we can clearly see deadlock exists.

Thus option should be:

(1) Mutual Exclusion is guaranteed- False
(2) Deadlock free Algorithm- False
(3) Progress is guaranteed - True

edited by
0 votes
0 votes
The answer will be false for all the three conditions because the initial values are not declared for both the variables.

Related questions

0 votes
0 votes
2 answers
1
shivajikobardan asked Jul 22, 2023
727 views
Sorry if this is a stupid question. But it really intrigued me. Same resources at different algorithms are telling different ways to test these stuffs.Here's an algorith...
1 votes
1 votes
1 answer
3
thor asked Sep 25, 2016
1,201 views
Can Mutual exclusion can be enforced with a general semaphore initial value is greater than 1 ?I think yes. Consider a semaphore $S = 2$, and following code segment for b...