We help IT Professionals succeed at work.

Why is Peterson's algorithm better at mutual exclusion that its predecessors?

shampouya asked
In very basic terms, what is the problem of mutual exclusion and how does Peterson’s Algorithm work? I only know that it sets variables equal to 0 or 1 as a way to signal which process can enter the critical region. What is the critical region? Why does Peterson’s Algorithm work better than the earlier attempts at mutual exclusion?
Watch Question

Most Valuable Expert 2014
Top Expert 2015
The critical region is a piece of code that must not be concurrently accessed by more than one thread of execution.
Peterson's Algorithm accomplishes mutual exclusion in a way that is simpler than Dekker's Algorithm which preceded it.
It also works better than algorithms earlier than Dekker's in that it avoids deadlock and starvation using only shared memory and not requiring  (atomic read/modify/write) instructions.