464 views

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

the correct answer should be 10

@MiNiPanda

Here also repeat forever then why we cant use P10 more than one time ?

$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