Skip to content

Interprocess Communication

Razvan Deaconescu edited this page Apr 14, 2019 · 2 revisions

Inter-Process Communication

Processes interact with the user and with processes on the same system or on different systems. This is part of the "do one thing do one thing well" philosophy. It is required for isolating resources but providing interaction, a solution to limitations in system resources (distributing resource use), and making sure different parties are able to communicate. Inter-process communication (IPC) defines the mechanisms provided by the system to allow process interaction. This may come in the form of shared memory or message passing mechanisms.

In this chapter we present the main IPC mechanism in operating systems. We discuss the POSIX shared memory API, UNIX and network sockets, pipes.

The main goal is for you to know the common IPC types and their use cases. You will be able to use the POSIX IPC APIs in your programs according their needs.

Contents

process IPC: message based vs memory based message queues APIs pipes, FIFOs, sockets synchronization, file locking

demos:

Rework demo of pipes, related processes

Show use of FIFO for non-related processes

Use lsof to show UNIX sockets for system processes

Do client-server demo on UNIX sockets

Do client-server demo on Berkeley sockets

Send byte-by-byte and receive all bytes on Berkeley sockets

Use shared memory to communicate between processes

Use semaphores to sync processes

Do OpenMP demo

Tasks

Create a process-per-connection, create a thread-per-connection

Create a pool of threads and make them treat each connection

Use file locking to sync shared memory access for processes

Clone this wiki locally