Implementing a Kernel-Mode Second-Tick Device Using Timer Lists

To build a kernel module that emulates a real-time second-counter device using the Linux kernel’s timer infrastructure, follow these precise, production-ready steps. This implementation leverages struct timer_list, avoids deprecated APIs (e.g., setup_timer), and ensures thread-safe, interupt-context–compatible behavior. Step 1: Define the Devic ...

Posted on Thu, 24 Sep 2026 16:33:31 +0000 by Patrick

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