Summary

We began this chapter by focusing on the key concepts of concurrency, atomicity, and the need to recognize critical sections and protect them. Locking is a typical way to achieve this; the pthreads API set provides the powerful mutex lock to do so. However, using locks, especially on large projects, is fraught with hidden problems and dangers—we discussed useful Locking guidelines, Deadlock and its avoidance.

This chapter then went on to guide the reader in the usage of the pthreads mutex lock. A lot of ground was covered here, including various mutex attributes, the importance of recognizing and avoiding the priority inversion issue, and variations on the mutex lock. Finally, we covered the need for and usage of the condition variable ...

Get Hands-On System Programming with Linux 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.