Professional Documents
Culture Documents
Dekker's Algorithm
Dekker's Algorithm
Dekker’s algorithms and Peterson’s Solution) for solving the mutual exclusion
problem. You have to devise the perfect and final solution (version of Dekker’s
Algorithm) in your solution.
Dekker’s Algorithm
Dekker's algorithm is the first known correct solution to the mutual
exclusion problem in concurrent programming. It allows two threads to share a
single-use resource without conflict, using only shared memory for
communication. Dekker’s algorithm was the first provably correct solution to the
critical section problem. It allows two threads to share a single-use resource
without conflict, using only shared memory for communication. It avoids the strict
alternation of a naïve turn-taking algorithm and was one of the first mutual
exclusion algorithms to be invented.
First version of Dekker’s solution
The process P first assigns flag[i] = true. Then it sets the 'turn = j' by asserting that
if any other process wants to enter the critical section, it is possible to do so.When
both processes are attempted to enter at the same time, the 'turn' value will be set to
both i and j at roughly the same time. Here one assignment is last and other will
happen.The process which has to be entered its critical section first will be decided
by the value of 'turn '.
Analysis:
The perfect and final solution for solving mutual exclusion is Dekker’s fifth
version