I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous 4 cars). There are also classic easily-deadlocked problems like The Dining Philosophers, but these may be too complex for a real newbie to fully grasp.
I'm looking for the simplest code example to illustrate what deadlocks are. The example should:
- Relate to a "real" programming scenario that makes some sense
- Be very short, simple and straight forward
What do you recommend?
See Question&Answers more detail:os