Critical state problem

  • #1
prashantgolu
50
0
i read this as a solution to critical state problem in galwin

repeat
while turn!= i do no-op;
critical section
turn := j;
remainder section
until false;


now this algo does not meet the "progress" conditiion.....
the book states the reason as.....this requires strict alteration of processed in execution of their critical state
for ex...if turn =0 and p1 is ready to enter its critical section,it cannot do so...even though p0 maybe in its remainder section...

how can p1 be in its remainder section and turn still be 0....

how does this algo not meet the reqirement of progress???
 

Answers and Replies

  • #2
36,324
8,286
i read this as a solution to critical state problem in galwin

repeat
while turn!= i do no-op;
critical section
turn := j;
remainder section
until false;
As stated here, this doesn't make much sense. Is this just a part of an algorithm and you haven't shown us the rest? We don't know the value of i, so can't tell whether turn != i is true or false.
now this algo does not meet the "progress" conditiion.....
the book states the reason as.....this requires strict alteration of processed in execution of their critical state
for ex...if turn =0 and p1 is ready to enter its critical section,it cannot do so...even though p0 maybe in its remainder section...

how can p1 be in its remainder section and turn still be 0....

how does this algo not meet the reqirement of progress???
What are p0 and p1? They aren't mentioned in the algorithm you showed.
 
  • #3
prashantgolu
50
0
sorry...my fault...turn=0 initaially....and p0 and p1 are two processes....this algorithm is for 2 processes only...so turn can be 0 or 1...
 
  • #4
amit88
1
0
Ya, it is true that the algorithm does not satisfy the condition of progress....

Imagine a case when p1 has entered its critical section. After executing, it turns the value of turn to 0 and exits. But the process p0 does not want to enter its critical section. So the value of turn would be set to 0 for ever. Even though if process p1 wants to enter its critical section again, it cannot do so, until process p0 wishes to enter its critical section.
Hence the condition of progress is not satisfied.

I hope I was able to explain you. Do let me know....:approve:
 
  • #5
prashantgolu
50
0
thanks a lot :)
 
  • #6
rcgldr
Homework Helper
8,791
579

Suggested for: Critical state problem

Replies
22
Views
386
  • Last Post
Replies
16
Views
830
Replies
1
Views
455
Replies
2
Views
210
Replies
1
Views
346
Replies
2
Views
342
Replies
6
Views
451
  • Last Post
Replies
8
Views
653
Top