Description:
- Nondeterministic behavior caused by the times at which two or more threads access a shared variable
- Debug race condition is hard
- example: Bounded-buffer Problem, Producer and Consumer Problem
- Writer Process P, Producer
- Reader process Q: Consumer
- Where counter is shared variable
- Implementation of counter ++
- register1 = counter
- register1 = register1 + 1
- counter = register1
- Implementation of counter—
- register2 = counter
- register2 = register2 - 1
- counter = register2
- Process P and Q can get different counter values at the same time if line 3 of both implementations are executing