Alex Rivera | Logout

Comparing Unix/Linux IPC

Asked 2009-01-01T05:58:11.977
82

Lots of IPCs are offered by Unix/Linux: pipes, sockets, shared memory, dbus, message-queues...

What are the most suitable applications for each, and how do they perform?

Edit
Report

1 Answer

115

Unix IPC

Here are the big seven:

  1. Pipe

    Useful only among processes related as parent/child. Call pipe(2) and fork(2). Unidirectional.

  2. FIFO, or named pipe

    Two unrelated processes can use FIFO unlike plain pipe. Call mkfifo(3). Unidirectional.

  3. Socket and Unix Domain Socket

    Bidirectional. Meant for network communication, but can be used locally too. Can be used for different protocol. There's no message boundary for TCP. Call socket(2).

  4. Message Queue

    OS maintains discrete message. See sys/msg.h.

  5. Signal

    Signal sends an integer to another process. Doesn't mesh well with multi-threads. Call kill(2).

  6. Semaphore

    A synchronization mechanism for multi processes or threads, similar to a queue of people waiting for bathroom. See sy

answered 2009-01-01T06:09:13.500

Your Answer