0

How does strict alternation guarantee bounded waiting? If there are two process P⁰ and P¹. Suppose turn=0 but P⁰ doesn't want to enter CS. And P¹ wants to. Won't it lead to starvation, so how bounded waiting is guaranteed?

1 Answers1

0

Strict alternation implies there is unbounded waiting exactly due to the scenario you describe. If it is process 2's turn and it doesn't want to enter the critical section, then process 1 must wait for process 2 to enter and exit the critical section even though it was safe for process 1 to enter. Even worse, if process 2 halts while process 1 is waiting, then process 1 will wait forever.

An algorithm that strictly alternates violates both progress and bounded waiting properties.

As an aside, most good algorithms that alternate only do so under contention. For example, Peterson's Algorithm alternates between processes when the critical section is contended. However, if there is no contention (like the situation you describe), then a process can enter the critical section even though it is not its turn. Hence, Peterson's Algorithm has bounded waiting.

Sagar
  • 1,617
  • 9
  • 17