IPC stands for Inter Process Communication.
Some time there is a requirement for passing data from one process to another
to do some task. This transfer of data from one program to another is done
using inter process communication mechanism.
IPC Mechanism includes:
1) PIPES
2) Named PIPES :FIFO
3) Shared Memory
4) Message Queue
5) Semaphores
6) Socket
PIPES: Pipes provides a mechanism of
passing data between related processes. Related process means their is a
requirement of having elation between these processes who are using pipe to
communicate with each other. The pipe is then used for communication either
between the parent or child processes, or between two sibling processes.
Pipes
are half duplex inter process communication mechanism. They are implemented as
circular buffers. The default size for pipe is 64KB. Pipe is created using the
system cal pipe(). pipe() call receives an integer array of size 2 as argument
and fill this array with the file descriptors for the reading and writing ends
of the pipe. For inter process communication to happen the process that created
pipe, must send a pipe file descriptor to the other process using fork and excel
system calls.
The
writing and reading from the pipe could be done using write() and read() system
calls. Pipe works in first n first out manner i.e., data that is entered first
is read first. If the writer writes into the pipe that is already full and the
reader is connected to another end would result in block on write for the writer
process. If the reader tries to read from the pipe that is already empty and
writer is connected to other end, would result in block on read. If the writer
tries to write to the pipe where there is no reader present at the other end,
this process is illegal and would result in kernel raising a SIGPIPE signal
that would terminate the writing process. If reader tries to read fom the pipe
where there is no writer present at the other end, it reads all data from the
pipe and when pipe becomes empty reader will receive a SIGPIPE signal and
terminates.
Source: - http://goo.gl/xFGFhn