7.3. Deadlocks, Starvation, and Other Synchronization Bugs

The reason you use the synchronization mechanisms described in the preceding sections is to prevent threads from colliding with one another when they access global resources. When used properly, the synchronization mechanisms accomplish this goal. Unfortunately, one of their problems is that they can breed their own special variety of bugs, both simple and complex. Several of these bugs are demonstrated in this section.

One classic synchronization problem is called the"dining philosophers" problem. You will find a solution to this problem in every textbook on operating systems. It may initially seem a bit contrived if this is the first time you have seen it, but it is a good metaphor ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.