8. Hand-Coded Synchronization and Sharing

The synchronization mechanisms provided by the operating system are typically designed to be fully featured, fast, and correct. In most cases, these will be the appropriate mechanism to use. However, there will be situations where it is desirable to have a different mechanism for synchronization and sharing, and often the motivation for this is one of improved efficiency.

Many pitfalls are associated with coding synchronization primitives. The objective of this chapter is to describe the issues that need to be faced when writing synchronization and communication primitives, both to provide information when doing this and to explain why the operating system–provided mechanisms are coded the way that they ...

Get Multicore Application Programming: For Windows, Linux, and Oracle® Solaris 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.