• POSIX real-time signals in Linux


    Signals are notifications delivered asynchronously to a process by the kernel. Signals are grouped in two categories. First, there are standard signals, which have been there since the early days of Unix. Second, there are POSIX real-time signals which are specified in POSIX.1b, or, IEEE Std 1003.1b-1993, for Real-time Extensions for POSIX ...

  • How to create a temporary file in Linux

    Temporary Files

    Quite often, we need temporary files in our programs. Some intermediate data needs to be stored and the file can be discarded when the process terminates. There are multiple ways of creating temporary files in Linux. The best way to create a temporary file in Linux is to use the O_TMPFILE ...

  • Interprocess Communication using Unix Domain Sockets

    Unix domain sockets (UDS) are used for inter-process communication (IPC) between processes running on the same host system. The API for Unix domain sockets is similar to that used for communication between processes running on hosts connected over a network.

    Table of Contents

    • Unix Domain Sockets
    • Call sequence
    • File I/O in Linux

      Input and Output (I/O)

      All programs need to interact with the external world which makes I/O important. Programs store data in files which provide large persistent storage. In this post we will look at the system calls and functions for file I/O and the issues that govern the program and I/O device interaction.

      Table ...

    • How to trim a string in C

      Trim a string

      The problem of removing leading and trailing whitespace characters in strings occurs in programming quite often. Here is a solution.

      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <ctype.h>
      void trim (char *dest, char *src); 
      int main (int argc, char ...
    • Socket programming using the select system call

      The select system call allows the calling process to monitor sets of file descriptors for readiness for non-blocking I/O operations. After the file descriptors ready for I/O are returned, the process goes ahead with the I/O operations on those file descriptors.

      Table of Contents

      • Client-Server Paradigm
      • Socket Programming using UDP in C

        Socket programming involves development of programs for communication between processes running on remote hosts connected over the network. The User Datagram Protocol (UDP) is a core commnication protocol for transmission of datagram packets without connection setup or retransmission of lost packets. As UDP has minimum overheads, it is suited for applications that require fast response ...

      • Socket Programming using TCP in C

        Socket programming involves development of programs for communication between processes running on remote hosts connected over the network. The Transmission Control Protocol (TCP) is for connection-oriented reliable communication between processes running on hosts over the network.

        Table of Contents

        • Client-server model
        • Network addresses and ports
        • Sockets
        • Signals in Linux


          A signal is a notification delivered to a process by the kernel. A signal indicates that an event has occurred and the process must take note of it. Signals are mostly delivered asynchronously to a process. Whatever the process was doing is suspended and the processing of the signal takes place immediately.

          Table ...

        • D-Bus Tutorial

          D-Bus is a mechanism for interprocess communication for Linux systems. D-Bus concepts along with example client-server programs are explained.

        • POSIX Shared Memory in Linux

          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 to the ...

        • System V Shared Memory in Linux

          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 address space ...

        • Queue implementation in C using a linked list


          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 of their ...

        • POSIX Threads Synchronization in C

          POSIX Threads Synchronization

          POSIX threads aka pthreads, 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 data is visible to multiple threads of a process. The threads need to synchronize their actions so that a thread does ...

        • POSIX Threads Programming in C

          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. ...