closed by
244 views
0 votes
0 votes
closed with the note: satisfying answer
is bounded waiting always satisfied if there are two processes?if not then plz explain
closed by

1 Answer

0 votes
0 votes

Bounded buffer problem  in case of 2 process solution means that there must be a time limit after which the process is allowed to enter the C.S.

P0:

while(1)

{

  while(turn!=0);

  C.S.;

 turn =1;

 remainder section;

}

---------------------------------------------------------------------

P1:

while(1)

{

   while (turn!=1);

   C.S.

    turn =0;

   remainder section;

}

----------------------------------------------------------------------------

here when turn is 0 control goes to process P0 and it executes C.S. and suppose it never makes turn =1;

now suppose after this P1 also wants to go to C.S.

so it will not be able to go since turn =0 and for P1 to enter C.S. turn should be 1.

=> A process wants to go to C.S. but cant go. It may take 1 sec , 1 minute , 1 day or 1 year for P0 to make turn =1 after which P1 may get a chance to enter C.S.

=> this is bounded buffer problem.

No related questions found