Interprocess Communication (IPC)
When two or more process are required to communicate, then various IPC mechanism are used by the OS which involves making numerous system calls. Some of them are :
- pipe(): Creates a unidirectional communication channel between processes. For example, a parent process may communicate to its child process through a pipe making a parent process as input source of its child process.
- socket(): Creates a network socket for communication. Processes in same or other networks can communicate through this socket, provided that they have necessary network permissions granted.
- shmget(): It is short for – ‘shared-memory-get’. It allows one or more processes to share a portion of memory and achieve interprocess communication.
- semget(): It is short for – ‘semaphore-get’. This call typically manages the coordination of multiple processes while accessing a shared resource that is, the critical section.
- msgget(): It is short for – ‘message-get’. IPC mechanism has one of the fundamental concept called – ‘message queue’ which is a queue data structure inside memory through which various processes communicate with each other. This message queue is allocated through this call allowing other processes a structured way of communication for data exchange purpose.
Different Types of System Calls in OS
System calls are interfaces provisioned by the operating system to allow user-level applications to interact with low-level hardware components & make use of all the services provided by the kernel, which is a core component and the heart of an operating system that manages all the hardware and the services provided by the OS. These system calls are essential for every process to interact with the kernel and leverage the services provided by it.
System calls are basically an interface between a process and the operating system. And they’re the only way to switch from user mode to kernel mode.
Pre-requisite: Introduction to System Calls