Given below is a program which when executed spawns two concurrent processes:…

GATE · 2005 · IT

Given below is a program which when executed spawns two concurrent processes:

semaphore X := 0;
/* Process now forks into concurrent processes P1 and P2 */

P1: repeat forever       P2: repeat forever
    V(X);                    P(X);
    Compute;                 Compute;
    P(X);                    V(X);

Consider the following statements about processes P1 and P2:

  1. It is possible for process P1 to starve.

  2. It is possible for process P2 to starve.

Which of the following holds?

  1. A.

    Both I and II are true

  2. B.

    I is true but II is false

  3. C.

    II is true but I is false

  4. D.

    Both I and II are false

Attempted by 290 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…