
1
COP 4604 UNIX System Programming
IPC
Dr. Sam Hsu
Computer Science & Engineering
Florida Atlantic University
2
UNIX IPC
Signals
Pipes
FiFOs
Semaphores
Shared Memory
Messages Queues
3
Interprocess Communication
Interprocess communication (IPC) provides
two major functions/services:
Information exchange
For data transfer among processes.
Process synchronization
For synchronization of process execution.
4
Various IPC Implementations
•
•
•
UDS
UDS
•
•
•
MacOS X
10.3
•
opt
•
•
•
opt, UDS
opt, UDS
•
•
•
Linux
2.4.22
•
•
••
XSI option
Sockets
STREAMS
•
•
•
•
•
•
XSI
XSI
XSI
Message queues
Semaphores
Shared memory
•, UDS
•, UDS
•, UDS
UDS
Allowed
XSI option
Full-duplex (FDX) pipes
Named FDX pipes
(full)
•
(full)
•
•
•
Half-duplex (HDX) pipes
FIFOs (named pipes)
•••Signals
Solaris
9
FreeBSD
5.2.1
SUSIPC Type
5
Signals
Most widely known UNIX IPC facility.
Used primarily to inform processes the
occurrence of asynchronous events.
Posted by one process and received by
another or the same process.
The receiving process performs an action
appropriate to the signal received:
Default (SIG_DFL).
Ignored (SIG_IGN).
User-defined.
6
Pipes
A pipe is a communication channel that couples one
process to another.
Historically, a pipe is one way (HDX) only. However, newer
implementations support two way (FDX) pipes.
Pipes are used between processes that have a common
ancestor.
More specifically, for communication between parent and child
in general.
There are two types of pipes: named and unnamed
Unnamed pipes are used for communication between related
processes.
Named pipes can be used for communication between
unrelated processes.