922 views
6 votes
6 votes

Each process $P_i$, where $i= 1$ to $9$ is coded as follows  

repeat 
 P (mutex)
   {critical section }
 V (mutex)
 forever 


The code for $P_{10}$ is identical except that it uses $V$ (mutex) instead of $P$ (mutex) and vice-verse. What is the largest number of processes that can be inside the critical section at any moment if initial value of the semaphore is 1? 

  1. 1
  2. 2
  3. 3
  4. none

5 Answers

0 votes
0 votes

$P_1$ enters CS; preempt. mutex = 0 now.

$P_{10}$ enters CS; preempt. mutex = 1 now.

$P_2$ enters CS. mutex = 0 again.

That's it.

Option C

Answer:

Related questions

1 votes
1 votes
2 answers
6