As the name suggests, the semaphore does not have a name in the Linux File system. These semaphores are also called as memory-based semaphores. since, the semaphore does not have a name associated with it in the Linux File system, the semaphore needs to be placed in a shared memory region that different processes or […]
Named Semaphore in Linux user space
Named semaphores as the name suggests have a name in the Linux file system. Hence different unrelated processes or threads can open the semaphore by invoking the name. The Named semaphore can be created or an existing instance opened by invoking the “sem_open” API. The API is shown below The name identifies the semaphore. The […]
Locking Mechanisms for Threads
Since Threads share the global heap, initialized data and uninitialized data segment with one another, it is possible that there would be race conditions between two threads. To prevent race conditions and to set up synchronization between the different threads, POSIX supports the following locking or thread synchronization mechanisms. POSIX Semaphores: named semaphores The semaphore […]
Simple Thread Example
The below example code taken from Linux programming interface by Michael Kerrisk is provided below The output of the above snippet of code is provided below Locking mechanisms for threads
POSIX Threads in Linux
Threads are a mechanism that permits an application to perform various tasks. The thread has its own stack but it shares the global memory of the parent process which includes initialized data, uninitialized data, and heap segments. The memory segment sharing is shown below: The threads spawned by a process can execute concurrently. Threads provide […]
FIFO Inter-process communication in Linux User space
FIFO is similar to a pipe in the, but a FIFO has a name within the file system and hence can be opened like a normal file. This allows two un-related processes to communicate with each other using a FIFO. Since a FIFO has a name in the Linux name space, FIFO is also termed […]
Inter-process communication using Pipes in Linux User Space
Pipes is an inter-process communication method. Pipes are the oldest inter-process communication method in Unix. The below image depicts a basic mode of operation of a pipe. As can be seen from the image that pipe communication is uni-directional and data can only travel in a single direction in a pipe. As seen in the […]
Handling Receive packets via NAPI
NAPI stands for New API though currently it is not so new 🙂 . The network driver receives a large number of packets and at a fast pace. For each packet, if a Hardware IRQ is raised, the software driver would need to wake up for each interrupt and handle the packets. Interrupt service processing […]
How is Data packet TX/RX handled?
In a previous article <Network device driver interfaced to a Hardware peripheral>, we saw how a networking device driver which is connected to a peripheral hardware device is instantiated at its lower edge and later the driver creates a net device interface for the Linux system to access. The below image from the article will […]