Starvation
The reader/writer lock example illustrates starvation: under load, a writer will be stalled forever by a stream of readers.
- Example: a one-lane bridge or tunnel.
Wait for oncoming car to exit the bridge before entering.
Repeat as necessary.
- Problem: a “writer” may never be able to cross if faced with a continuous stream of oncoming “readers”.
- Solution: some reader must politely stop before entering, even though it is not forced to wait by oncoming traffic.
Use extra synchronization to control the lock scheduling policy.
Complicates the implementation: optimize only if necessary.