What is inter-process communication (IPC)? What are some examples?
OS supported mechanisms for interaction among processes (coordination and communication)
How does message passing IPC work?
What is the kernel responsible for and how much user/kernel boudary crossings does this IPC require?
send/recv messages
OS creates and maintains a channel (e.g., buffer, FIFO queue)
OS provides interface to process - a port
kernel required to:
Request/Response:
4x user/kernel crossings + 4x data copies
What are the pros/cons of message passing IPC?
Pros:
+ simplicity. kernel does channel management and sychnronization
Cons:
How do pipes work? What form of IPC?
Carry byte stream between two processes (e.g., connect output from one process to input of another)
Pipes are an example of message passing IPC.

How do message queues work?
What is the OS responsible for?
What form of IPC?
Carry “messages” among processes
OS managment includes priorities, scheduling of message delivery
APIS: SysV and POSIX
Message queues are an example of message passing IPC.

How do sockets work?
What form of IPC?
> if different machines, channel is between processes and network device
> if same machone, bypass full protocol stack
Sockets are an example of message passing IPC.

How does shared memory IPC work?
What is the OS responsible for and how much user/kernel boudary crossings does this IPC require?
processes read and write to a shared memory region
OS establishes shared channel between the processes:

What are the pros/cons of shared memory IPC?

Pros:
+ one shared memory segment is established the OS is out of the way
+ system calls only for setup
+ data calls potentially reduced (but not eliminated) for data to be visible to both processes it but be allocated from virtual memory addresses that belong to the shared region. if that’s not the case then data from the same address space has to be copied in and out of the shared memory region
Cons:
APIS: SysV, POSIX, memory mapped files
Copy (messages) vs Map (shared memory)
Copy
Map
=> set up once, use many times = good payoff
=> can perform well for 1-time use (e.g., large data)