Skip to content
Search

Inter-process communication

lastmod 2025-01-24created 2017-02-2119 edits

Inter-Process Communication (IPC) refers to the act of exchanging data between processes, or the methods or paths for doing so.

Main IPC methods

Method

Provided by (operating systems or other environments)

Computer file

Most operating systems

Unix signal

Most operating systems. Some systems, such as Windows, provide signals only in the C runtime library and do not support using them as an IPC method.

Network socket

Most operating systems

Message queue

Most operating systems

Pipe (Unix)

All POSIX systems, Windows

Named pipe (fifo)

All POSIX systems, Windows

Korean: 세마포어

All POSIX systems, Windows

Korean: 공유 메모리

All POSIX systems, Windows

Message passing
(shared nothing)

Used in the Message Passing Interface (MPI) paradigm, Java RMI, CORBA, Microsoft Message Queuing (MSMQ), Mailslots, QNX, and others

Memory-mapped file

All POSIX systems, Windows

IPC performance comparison

To measure sequential throughput, we send a single message back and forth (i.e., ping-pong) between two processes.

Method

100 Byte Messages

1 Kilo Byte Messages

Unix Signals

--broken--

--broken--

ZeroMQ (TCP)

24,901 msg/s

22,679 msg/s

Internet sockets (TCP)

70,221 msg/s

67,901 msg/s

Domain sockets

130,372 msg/s

127,582 msg/s

Pipes

162,441 msg/s

155,404 msg/s

Message Queues

232,253 msg/s

213,796 msg/s

FIFOs (named pipes)

265,823 msg/s

254,880 msg/s

Shared Memory

4,702,557 msg/s

1,659,291 msg/s

Memory-Mapped Files

5,338,860 msg/s

1,701,759 msg/s

Benchmarked on Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz running Ubuntu 20.04.1 LTS.

NOTE: The code is rather old and there might be sub-optimal configurations! We are happy to update the configuration with concrete suggestions (see contributions below). In particular, zeromq is a great library and should probably be performing better, especially because we are only using the TCP implementation. There is one dedicated for IPC (-> TODO). In addition, there is little technical reason for shared memory to perform differently than memory-mapped files (could be due to a lack of warmup). Non-the-less, hopefully, this benchmark can serve as a solid starting point by providing ball-park numbers and a reference implementation.

For a detailed evaluation of inter-node communication, see the L5 library.

The performance difference between Unix Domain Sockets and Named PIPE seems to vary by PC/OS.

TCP/IP vs Unix Domain Sockets vs Named PIPE

See Unix Domain Socket#TCP/IP vs Unix Domain Sockets vs Named PIPE.

Performance difference between Shared Memory and regular thread memory

Differs only at initial Page creation; otherwise similar

Posix shared memory vs mapped files

The distinction is not always clear. Shared memory can be implemented through memory-mapped files.

Related: Memory Mapped Files And Shared Memory For C++

  • std::memory_mappable
  • std::mapped_region

Standard I/O Pipe speed test

For a method using the dd command, see Standard streams#Standard I/O Pipe speed test.

See also

Favorite site

author Zer0 sitemap