The Little Book of Semaphores
Allen Downey, Franklin W. Olin College of Engineering
Publisher: Green Tea Press
Read This Book
Conditions of Use
The book certainly stays true to its title. Scope of semaphores is discussed in a comprehensive manner; begins with a gentle, but motivational read more
The book certainly stays true to its title. Scope of semaphores is discussed in a comprehensive manner; begins with a gentle, but motivational introduction, and covers known and less well-known synchronization problems, and also introduces new problems that can perk up students’/instructor’s curiosity. Nicely rounds up the discussion with coding techniques for popular languages such as Python and C. Additionally the book is comprehensive because the author is on the money in not only noting that synchronization takes lots of practice to get it right, but in providing a variety of motivational examples and puzzles (for students to solve) to help reinforce students’ comprehension of this rather difficult topic!
Both synchronization primitives and solution strategies are accurately described.
Semaphores have been a major part of Operating Systems literature for over 5 decades; while I don’t have a crystal ball, since the book addresses this issue in an extensive manner, it (the book) is likely to remain relevant for the foreseeable feature. I also feel that the code snippets in the book can be easily tried out in class or lab with no to minimal modification. The book's organization also permits incremental addition of (future) content.
The writing style is certainly engaging and is likely to be a draw for the student! Problems and solution strategies are introduced in a progressive manner so the reader can easily and clearly follow the information being conveyed.
The book adopts simple-to-follow notation and is consistent in its use throughout the text. The notation/pseudo-code has a more natural-language feel that is likely to appeal to the reader.
Information is compartmentalized into modules that are small and manageable. And, there is a nice cohesion b/w adjacent modules (chapters). The chapters are also fairly self-contained, and permits one with a bit of familiarity, to jump to specific chapters.
Organization is just fine and the book reads well as information is supplied on an as-needed basis.
The book has minimal to no interface issues. In fact, the layout of the material is pretty clever and handles pagination issues rather nicely; puzzles are presented throughout the text, and information for each puzzle is contained in one page with (blank) space on that page for the reader to solve the puzzle – should one be stumped, (more) hints are found on a subsequent page, with space for another crack at solving the problem.
The book is well-written with no apparent grammatical issues.
The content and language is culture-neutral and should appeal to folks from any culture.
Couple of observations: while the title is fine, one wonders if synchronization could have been part of the title – the word, ‘synchronization,’ has wider appeal, and the book is pretty much focused on synchronization; an appendix on pthread availability for Visual C++ would be a nice addition – just indicate that pthread is available for Visual C++, and perhaps provide an example of its application (in Visual C++); the amount of class time one can spend on semaphores is no more than a couple of weeks, and I concur with the author that (while semaphores is an important topic) many topics compete for attention in an Operating Systems class – in other words, it may not be possible to cover some of the chapters in the text
This little gem of a book is an excellent introduction to semaphores and their use in synchronization/concurrency control. The book discusses a large read more
This little gem of a book is an excellent introduction to semaphores and their use in synchronization/concurrency control. The book discusses a large number of concurrency control problems both simple and hard. The book is quite comprehensive in terms of the range of concurrency control problems it covers. For each problem, the book walks the reader through a number of solutions including non-solutions that might lead to deadlocks or starvation. Each solution is very nicely described. The book does not talk much about the basic mechanisms used to achieve mutual exclusion (such as interrupt disabling, test-and-set instruction, algorithms such as Peterson's algorithm). There is no separate treatment of deadlocks (and deadlock detection/avoidance/prevention strategies) beyond what is covered in the discussion of solutions to various concurrency control problems.
The content is accurate and very reader friendly.
Concurrency control as a topic is unlikely to become obsolete in foreseeable future. All undergraduate level courses in Operating Systems devote a significant portion of class time to the concurrency control discussion. The book is an excellent textbook for use in this discussion and will stay useful for many many years.
The book is very well written. Very easy to read.
The book is consistent in terms of the terminology used.
The book is highly modular.
The book is very well structured. Various chapters follow a logical order.
The book is formatted in a manner that makes it easy for the instructor to use the book pages as class handouts, which is nice.
There are no grammatical errors.
There is no culturally insensitive or offensive content in this book.
Very valuable contribution to the field.
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
- A Cleaning up Python threads
- B Cleaning up POSIX threads
About the Book
The Little Book of Semaphores is a free (in both senses of the word) 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.
About the Contributors
Allen B. Downey is an American computer scientist, Professor of Computer Science at the Franklin W. Olin College of Engineering and writer of free textbooks. Downey received in 1989 his BS and in 1990 his MA, both in Civil Engineering from the Massachusetts Institute of Technology, and his PhD in Computer Science from the University of California at Berkeley in 1997. He started his career as Research Fellow in the San Diego Supercomputer Center in 1995. In 1997 he became Assistant Professor of Computer Science at Colby College, and in 2000 at Wellesley College. He was Research Fellow at Boston University in 2002 and Professor of Computer Science at the Franklin W. Olin College of Engineering since 2003. In 2009-2010 he was also Visiting Scientist at Google Inc.