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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.