Inter-process communication is a mechanism that allows two or more separate running processes to transfer data between each other.

Mechanisms

More types of IPC:

In UNIX systems

Some relevant syscalls:

  • read: takes data from a file descriptor. It returns the number of bytes read. At the end of the stream, it returns 0 bytes read.
  • write: writes data to a file descriptor. It returns the number of bytes written.
  • pipe: forms a one-way communication channel using two file descriptors.
    • This takes a 2-sized integer array pipefd. pipefd[0] is the “read” end of the pipe, and pipefd[1] is the “write” end of the pipe.
    • This is effectively a buffer managed by the kernel.
    • We can take advantage of process forking to allow two processes to effectively communicate via the two ends.