204 views
5 votes
5 votes

Consider the following two-process synchronization solution.

P0:
while(TRUE) {
  while(turn!=0);
  critical_section();
  turn = 1;
  noncritical_section();
}
P1:
while(TRUE) {
  while(turn!=1);
  critical_section();
  turn = 0;
  noncritical_section();
}


The shared variable turn is initialized to zero. Which one of the following is TRUE?

 

  1. This is a correct two-process synchronization solution satisfying mutual-exclusion, progress and bounded waiting.
  2. This solution violates mutual exclusion requirement.
  3. This solution violates progress requirement.
  4. This solution violates bounded wait requirement.

 

1 Answer

Best answer
6 votes
6 votes
The given strict-alteration solution for $2$ process synchronization satisfies mutual exclusion and bounded waiting requirements but progress requirement is not satisfied. This is because each process at end is giving the turn to another and so if the other process is not scheduled in alteration the current process is forced to wait even though no process is in critical section.
selected by
Answer:

Related questions

3 votes
3 votes
1 answer
1