System Design
16. Performance EngineeringAnimated
Concurrent Programming
Multiple tasks in progress at once.
The idea
Tasks interleave and may share state, which needs care.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- current message
- earlier
- failure or attack
Txn 1 locks row A.
- step:
- 1/6
- from:
- Txn 1
- to:
- Row A
1/6
Time runs downward. Solid arrows are requests, dashed arrows are replies.
Step by step
- 1Split work into tasks
- 2Run them concurrently
- 3Protect shared state
- 4Join results
Where it is used
Servers.
Watch out for
Races and deadlocks.