« Back to What is ...?

What is inter-process communication (IPC)?

What is Inter-process communication (IPC)?

Inter-process communication (IPC) provides processes with the capability to communicate with each other. This communication can happen via a variety of ways, using process signals, pipes, message queues, semaphores, and shared memory usage.

Inter-process communication (IPC) provides processes with the capability to communicate with each other. This communication can happen via a variety of ways, using process signals, pipes, message queues, semaphores, and shared memory usage.

Signals

Processes can receive or send a signal to be informed about a specific event or action to take, such as stop running (SIGSTOP, SIGKILL, SIGTERM).

# kill -l
 1) SIGHUP	2) SIGINT	3) SIGQUIT	4) SIGILL	5) SIGTRAP
 6) SIGABRT	7) SIGBUS	8) SIGFPE	9) SIGKILL	10) SIGUSR1
11) SIGSEGV	12) SIGUSR2	13) SIGPIPE	14) SIGALRM	15) SIGTERM
16) SIGSTKFLT	17) SIGCHLD	18) SIGCONT	19) SIGSTOP	20) SIGTSTP
21) SIGTTIN	22) SIGTTOU	23) SIGURG	24) SIGXCPU	25) SIGXFSZ
26) SIGVTALRM	27) SIGPROF	28) SIGWINCH	29) SIGIO	30) SIGPWR
31) SIGSYS	34) SIGRTMIN	35) SIGRTMIN+1	36) SIGRTMIN+2	37) SIGRTMIN+3
38) SIGRTMIN+4	39) SIGRTMIN+5	40) SIGRTMIN+6	41) SIGRTMIN+7	42) SIGRTMIN+8
43) SIGRTMIN+9	44) SIGRTMIN+10	45) SIGRTMIN+11	46) SIGRTMIN+12	47) SIGRTMIN+13
48) SIGRTMIN+14	49) SIGRTMIN+15	50) SIGRTMAX-14	51) SIGRTMAX-13	52) SIGRTMAX-12
53) SIGRTMAX-11	54) SIGRTMAX-10	55) SIGRTMAX-9	56) SIGRTMAX-8	57) SIGRTMAX-7
58) SIGRTMAX-6	59) SIGRTMAX-5	60) SIGRTMAX-4	61) SIGRTMAX-3	62) SIGRTMAX-2
63) SIGRTMAX-1	64) SIGRTMAX	

Pipes

Pipes provide the output from one process to another one, typically for further processing.

ps -ef | grep systemd
root         237       1  0 Dec17 ?        00:00:00 /lib/systemd/systemd-journald
root         255       1  0 Dec17 ?        00:00:00 /lib/systemd/systemd-udevd
systemd+     311       1  0 Dec17 ?        00:00:00 /lib/systemd/systemd-timesyncd
message+     528       1  0 Dec17 ?        00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root         533       1  0 Dec17 ?        00:00:00 /lib/systemd/systemd-logind
michael      574       1  0 Dec17 ?        00:00:00 /lib/systemd/systemd --user
root       12290     591  0 12:59 pts/0    00:00:00 grep systemd

Semaphores

Semaphores provided a location in memory of which the value can be view and test by multiple processes.

Related syscalls include:

  • semctl(2)
  • semget(2)
  • semop(2)
  • semtimedop(2)

Message queues

A message queue provides two or more processes a way to communicate. Each of them opens the message queue using the mq_open(3) function call that includes a name of the queue. Messages then can be shared.

Related syscalls include:

  • mq_getsetattr(2)
  • mq_notify(2)
  • mq_open(2)
  • mq_timedreceive(2)
  • mq_timedsend(2)
  • mq_getsetattr(2)
  • mq_timedreceive(2)
  • mq_timedsend(2)
  • mq_unlink(2)

Shared memory

By using shared memory, processes can communicate via shared virtual address space that is visible to them. Access is controlled via keys and by using some permission checks. When a process is allowed to use the shared memory, it can see those areas.

Feedback

Small picture of Michael Boelen

This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

Mastodon icon

Related articles

Like to learn more? Here is a list of articles within the same category or having similar tags.