Book Description
The Little Book of Semaphores is a free textbook that introduces the principles of synchronization for concurrent programming.
In most computer science curricula, synchronization is a module in an Operating Systems class. OS textbooks present a standard set of problems with a standard set of solutions, but most students don't get a good understanding of the material or the ability to solve similar problems.
The approach of this book is to identify patterns that are useful for a variety of synchronization problems and then show how they can be assembled into solutions. After each problem, the book offers a hint before showing a solution, giving students a better chance of discovering solutions on their own.
The book covers the classical problems, including "Readers-writers," "Producer-consumer", and "Dining Philosophers." In addition, it collects a number of not-so-classical problems, some written by the author and some by other teachers and textbook writers. Readers are invited to create and submit new problems.
This open book is licensed under a Creative Commons License (CC BY-NC-SA). You can download The Little Book of Semaphores ebook for free in PDF format (1.2 MB).
Table of Contents
Chapter 1
Introduction
Chapter 2
Semaphores
Chapter 3
Basic synchronization patterns
Chapter 4
Classical synchronization problems
Chapter 5
Less classical synchronization problems
Chapter 6
Not-so-classical problems
Chapter 7
Not remotely classical problems
Chapter 8
Synchronization in Python
Chapter 9
Synchronization in C
Appendix A
Cleaning up Python threads
Appendix B
Cleaning up POSIX threads