program

POSIX Shared Memory in Linux

1.0 Shared Memory Shared memory is an inter process communication (IPC) mechanism in Linux and other UNIX-like systems. Based on input parameters, the kernel provides a (shared) memory segment to the calling process. The calling process maps the shared memory segment to its address space. This way, the same shared memory segment can be mapped …

POSIX Shared Memory in Linux Read More »

System V Shared Memory in Linux

1.0 Shared Memory Shared memory is one of the three inter process communication (IPC) mechanisms available under Linux and other Unix-like systems. The other two IPC mechanisms are the message queues and semaphores. In case of shared memory, a shared memory segment is created by the kernel and mapped to the data segment of the …

System V Shared Memory in Linux Read More »

Queue implementation in C using linked list

1.0 Queue A queue is something we see often in our daily lives. People stand in a queue to get into a bus, to get food in a buffet, buy tickets from the ticket counter, etc. Queues are a fair solution of ordering people to get a resource; people are served in the chronological order …

Queue implementation in C using linked list Read More »

POSIX Threads Synchronization in C

1.0 POSIX Threads Synchronization POSIX Threads provide multiple flows of execution within a process. The threads have their own stacks but share the global data and the heap. So the global variables are visible to multiple threads. Also, the threads need to synchronize their actions so that they jointly realize the overall objectives of the …

POSIX Threads Synchronization in C Read More »

POSIX Threads Programming in C

1.0 POSIX threads A process is an execution environment in an operating system. A process has code and data segments which are initialized from a program during an exec system call. A process has a thread of execution, wherein instructions are executed as per the value of the program counter register. Associated with a process …

POSIX Threads Programming in C Read More »

POSIX Semaphores in Linux

1.0 Semaphores Semaphores are used for process and thread synchronization. Semaphores are clubbed with message queues and shared memory under the Interprocess Communication (IPC) facilities in Unix-like systems such as Linux. There are two varieties of semaphores, the traditional System V semaphores and the newer POSIX semaphores. In this post we will look at the …

POSIX Semaphores in Linux Read More »

System V Semaphores in Linux

1.0 Semaphores A semaphore is a mechanism for synchronizing processes and threads. Semaphore, in Unix-like systems, are provided under interprocess communication (IPC) facilities along with message queues and shared memory. While message queues can be used by themselves for interprocess communication, semaphores are needed for implementing shared memory based interprocess communication systems. Semaphores are not …

System V Semaphores in Linux Read More »

System V message queues in Linux

1.0 Message queues Message queues are one of the interprocess communication mechanisms available under Linux. Message queues, shared memory and semaphores are normally listed as the three interprocess communication mechanisms under Linux. Semaphores, though, are really for process synchronization. In practice, shared memory, aided by semaphores, makes an interprocess communication mechanism. Message queues is the …

System V message queues in Linux Read More »

fork and exec system calls in Linux

1.0 fork and exec system calls Suppose we wish to write a “shell program” which would execute another program. Now, in a computing system, a process executes a program. So this shell program (or, process, at run time) needs to create a process which would execute a program. Here, two system calls are of interest, …

fork and exec system calls in Linux Read More »