1,061 views
3 votes
3 votes

Assume 2 processes computer ( ) and science ( ) that are concurrent and that the three semaphore mutex,
Q and R initialized to 1 are shared between the two processes. Q is a semaphore on file 1 and R on file 2.

  • Deadlock and no starvation
  • No deadlock but starvation
  • Both deadlock and starvation
  • No deadlock or starvation

1 Answer

4 votes
4 votes

1 Computer: P(mutex),P(Q),P(R) | Science: P(Q)(sleeps) (1st Diagram)

2. Computer: P(mutex),P(Q),P(R) | Science: P(Q)(sleeps) | Computer: V(Q),V(mutex)  | Science: P(Q),P(R)(sleeps) | Computer: P(Q)(sleeps) (2nd Diagram)

As we can see deadlock exists.

Since there is a deadlock, there is starvation, as deadlock is a infinite waiting.

Answer: Both deadlock and starvation

edited by

Related questions

0 votes
0 votes
2 answers
1
sanyam53 asked Jan 10, 2017
1,022 views
0 votes
0 votes
1 answer
2
Mrityudoot asked Jan 27
178 views
Can a counting semaphore acquire a negative value?S = 2;15 P operations done, should the semaphore be 0 or -13