
Mastering Linux Kernel Development
By :

Semaphores are synchronization primitives provided by the IPC subsystem. They deliver a protective mechanism for shared data structures or resources against concurrent access by processes in a multithreaded environment. At its core, each semaphore is composed of an integer counter that can be atomically accessed by a caller process. Semaphore implementations provide two operations, one for waiting on a semaphore variable and another to signal the semaphore variable. In other words, waiting on the semaphore decreases the counter by 1 and signaling the semaphore increases the counter by 1. Typically, when a process wants to access a shared resource, it tries to decrease the semaphore counter. This attempt is however handled by the kernel as it blocks the attempting process until the counter yields a positive value. Similarly, when a process relinquishes the resource, it increases the semaphore counter, which wakes up any process that is waiting for the resource.
Semaphore versions...
Change the font size
Change margin width
Change background colour