A classic software-based solution to the critical-section problem is known as

2013

A classic software-based solution to the critical-section problem is known as

  1. A.

    Peterson’s solution

  2. B.

    Process synchronization

  3. C.

    Coordination

  4. D.

    Race condition

Attempted by 588 students.

Show answer & explanation

Correct answer: A

Peterson’s solution is a classic software-based algorithm for solving the critical-section problem for two processes. It uses two shared variables (flag[0..1] and turn) to coordinate entry to the critical section. Mutual exclusion: The protocol ensures that both processes cannot be in the critical section at the same time by checking the other process's flag and the turn variable.

Progress: If no process is in the critical section, a process that wishes to enter will be able to do so without being blocked indefinitely by unrelated processes.

Bounded waiting: Each process will wait for a bounded number of attempts by the other process before entering the critical section, preventing starvation.

Basic algorithm steps (for process i, where j is the other process): Set flag[i] = true (indicate desire to enter)

Set turn = j (give priority to the other process)

Wait while flag[j] is true and turn == j (busy-wait)

Enter critical section

Upon exit, set flag[i] = false

यह Peterson’s solution

Explore the full course: Niacl Ao It Specialist