Using Semaphores to Enforce Exclusive Access to an LED Device in Linux Kernel Driver

This example demonstrates how to implement a GPIO-controlled LED driver that ensures only one user process can access the LED at a time using a counting semaphore initialized to 1 (binary semaphore). The semaphore is acquired in the open() handler and released in the release() handler, effectively serializign access across multiple processes. D ...

Posted on Tue, 16 Jun 2026 17:08:44 +0000 by Distant_storm

Java Concurrency Utilities: CountDownLatch, Semaphore, and CyclicBarrier

This article explores three essential synchronization aids in Java: CountDownLatch, Semaphore, and CyclicBarrier. Thece tools simplify thread coordination for common concurrency patterns. CountDownLatch CountDownLatch allows one or more threads to wait until a set of operations being performed in other threads completes. It is initialized with ...

Posted on Sat, 30 May 2026 22:15:49 +0000 by macpaul

Avoiding Common Pitfalls When Using Java Semaphore

A Semaphore can be used to restrict concurrent access to a shared resource. However, subtle errors in its usage can lead to unexpected behavior, such as threads becoming blocked or the semaphore's permit count becoming incorrect. Consider a scenario where three threads attempt to acquire permits from a Semaphore initialized with a count of 2. A ...

Posted on Mon, 11 May 2026 00:20:40 +0000 by Cory94bailly