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 appropri-ate 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 are.
This chapter starts with a discussion of atomic operations and the atomic operations that are provided by the operating system. This is a useful warm-up for a discussion of how atomic operations can be hand-coded. The final section of the chapter discusses the issues around writing synchronization primitives.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.