371 views
0 0 votes
var occupied, var blocked;

Entry section:

{

   if(occupied)

   {

            blocked = blocked + 1;

            sleep();

   }

   else

            occupied = 1;

}

 

Exit section:

{

    occupied = 0;

    if(blocked)

    {

            wakeup(process);

            blocked = blocked - 1;

    }

}

 

which of the following is false?

(1) Mutual Exclusion is guaranteed (2) Deadlock free Algorithm (3) Progress is guaranteed (4)None

 

The answer given is (4)None . Reason- SInce both the variables are not initialized.

But in all conditions isn't Mutual exclusion never followed?

Since occupied=0 in exit section, a new process can come and enter the critical section; also one of the blocked processes which got woken up can also enter critical section- ie, 2 processes could be in critical section.

Please elaborate the correct working of this, for all the possible initial values of occupied and blocked.

Please log in or register to answer this question.

Position:
Show:

Related questions

3 3 votes
1 1 answer
261
261 views
GO Classes asked Feb 19
261 views
Which of the following statements regarding Semaphores and Monitors is/are CORRECT?A binary semaphore can be used to achieve Mutual Exclusion. If a process performing a $...
2 2 votes
1 1 answer
283
283 views
GO Classes asked Feb 5
283 views
Consider a counting semaphore $S$ initialized to $10$. The following operations are performed on $S$ in the given order:$\mathbf{12} ~P(S)$ operations $\mathbf{7} ~V(S)$ ...
3 3 votes
2 2 answers
349
349 views
GO Classes asked Jan 2
349 views
Consider a NON-NEGATIVE COUNTING SEMAPHORE $S$. The operation $P(S)$ (wait) attempts to decrement $S$, and the operation $V(S)$ (signal) increments $S$. A process executi...
0 0 votes
0 0 answers
518
518 views
legacy asked Nov 27, 2022
518 views
At the end of chapter 2, we studied a solution to the readers and writers problem, given below:-In this solution, as long as one reader is having the resource any new rea...