818 views
4 votes
4 votes

Consider the following situations for three process P1, P2 and P3. [Assume R1, R2 and R3 are resources]

S1: P1 is holding R1 but it is tied up in a busy wait loop repeatedly trying to access R2, which it never gets because R2 is held by P2. P2 is also stuck in a busy wait loop repeatedly trying to access R3, which it never gets because R3 is held by P3. P3 is also in a busy wait loop repeatedly trying to access R1.

S2: P1 is holding R1 and issued a blocking call for R2, which is held by P2. P2 issued a blocking call for R3, which is held by P3, P3 issued a blocking call for R1. Find which of the following is correct for above situations.

A) S1 is deadlock S2 is starvation

B) S1 is livelock S2 is starvation

C) S1 is starvation S2 is deadlock

D) S1 is livelock S2 is deadlock

Here it is very easy to see that S2 is deadlock. For S1 I am not sure why it should be livelock. It is starvation for sure, but every livelock is special case of starvation. Answer given is D)

Defination of Livelock :- A livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing.

Here can we say S1 is livelock because Processes P1,P2 , P3 are constantly changing between running & Ready states ? "states of the processes involved in the livelock constantly change with regard to one another, none progressing" is Processes switching between ready & Running state.

1 Answer

Related questions

2 votes
2 votes
1 answer
1
sumit kumar asked Nov 10, 2014
3,073 views
what is the difference between livelock and deadlock?how will you explain livelock to layman?asked at an interview @iitb
0 votes
0 votes
1 answer
3