Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | Gate IT 2005 | Question 41

  • Difficulty Level : Basic
  • Last Updated : 19 Jan, 2018

Given below is a program which when executed spawns two concurrent processes :
semaphore X : = 0 ;
/* Process now forks into concurrent processes P1 & P2 */

P1P2
repeat forever
V (X) ;
Compute ;
P(X) ;
 repeat forever
P(X) ;
Compute ;
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?

 
(A) Both I and II are true
(B) I is true but II is false
(C) II is true but I is false
(D) Both I and II are false


Answer: (A)

Explanation: P1 can get stuck on its P, while P2 loops forever. The dual is also possible: P2 gets stuck on its P while P1 loops forever.
Both statements are correct. Option (A).

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!