Dekker's Algorithm CASE A: P1 wants to enter its critical section P2 is in its non-critical section P1 sets needLock1 to 1 P1 sets turn to 2 P1 waits until turn is 1 or needLock2 is 0 P1 immediately enters its critical section CASE B: P1 is in its critical section P2 wants to enter its critical section P2 sets needLock2 to 1 P2 sets turn to 1 P2 waits until turn is 2 or needLock1 is 0 P2 blocked until P1 leaves its critical section and sets needLock1 to 0 CASE C: P1 and P2 both complete their non-critical sections; both want to simultaneously enter their critical sections. P1 sets needLock1 to 1 P1 gets interrupted P2 sets needLock2 to 1 P2 sets turn to 1 P2 is blocked P1 sets turn to 2 P1 is blocked P2 enters its critical section P2 sets needLock2 to 0 P1 enters its critical section P1 sets needLock1 to 0