Each Process Pi, i= 1.......9 is coded as follows repeat P(mutex) {Critical…

1997

Each Process Pi, i= 1.......9 is coded as follows

repeat 

    P(mutex)

    {Critical section}

    V(mutex)

 forever

The code for P10 is identical except it uses V(mutex) in place of P(mutex). What is the largest number of processes that can be inside the critical section at any moment?

  1. A.

    1

  2. B.

    2

  3. C.

    3

  4. D.

    None of above

Attempted by 8 students.

Show answer & explanation

Correct answer: D

Here is the condensed breakdown:

  • The Trap: Process P10 uses V(mutex) to enter the critical section, which increments the semaphore instead of decrementing it, completely breaking mutual exclusion.

  • The Loop: Because P10 is in a repeat...forever loop, it can continuously increment the semaphore value every time it loops.

  • The Result: This continuous incrementing creates enough "space" for all 9 standard processes (P1 to P9 ) to pass their P(mutex) checks and enter simultaneously alongside P10 , leading to a maximum of 10 processes.

Since 10 is not listed, D. None of above is the correct choice.

Explore the full course: Gate Guidance By Sanchit Sir