This technical tutorial by veteran real-time instructor David Kalinsky examines the high-level design of driver software to operate hardware devices that are interfaced to embedded computers. It begins with a discussion of basic issues such as mutual exclusion of device access, and synchronous vs. asynchronous input/output models. Then it goes through a series of structural models for device driver design with RTOS interaction, going from simple to more complex.
This was a great article, but I have a question. When he was talking about semaphores, he referred to them as binary semaphores. What is a binary semaphore, and how might it differ from some other kind of semaphore?
There are (at least) 3 different kinds of semaphores common in real-time operating systems: Counting semaphores, binary semaphores, and mutual exclusion semaphores (often called ‘mutexes’). Mutexes were invented to fix a problem called ‘unbounded priority inversion’ that can crop up when using the more “traditional” counting or binary semaphores. Mutexes themselves come in several varieties, including priority inheritance mutexes, priority ceiling mutexes, and highest-locker mutexes. A guy named Professor Dijkstra invented the “traditional” semaphores. Counting semaphores are used for regulating access to multiple equivalent resources (like if you’ve got 3 printers but 17 tasks may want to print on occasion). Binary semaphores are used for protecting single critical resources and for signaling between concurrent tasks. For more information about unbounded priority inversions and mutex semaphores, please see the following URL: http://www.kalinskyassociates.com/Wpaper2.html .