Interprocess Communication
Interprocess Communication
Inter-Process Communications
Carnegie Mellon
Process B’s
address space
Process A’s
address space
Process C’s
address space
Carnegie Mellon
IPC mechanisms
Cooperating processes require an IPC mechanism that will allow them to
exchange data - that is, send data to and receive data from each other
Two models of IPC
o Shared memory
o Message passing
▪ Synchronization
▪ Communication between processes takes place through calls to send() and
receive() primitives. There are different design options for implementing
each primitive
▪ Message passing may be either blocking or nonblocking - also known as
synchronous and asynchronous
Carnegie Mellon
▪ Synchronization
▪ Blocking is considered synchronous
o Blocking send -- the sender is blocked until the message is received
o Blocking receive -- the receiver is blocked until a message is
available
▪ Non-blocking is considered asynchronous
o Non-blocking send -- the sender sends the message and continue
o Non-blocking receive -- the receiver receives:
• A valid message
• Null message
Carnegie Mellon
▪ Buffering
o Unbounded capacity: The queue’s length is potentially infinite; thus,
any number of messages can wait in it
o The sender never blocks
Carnegie Mellon
▪ Sockets
▪ The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8
▪ Communication consists of a pair of sockets
▪ All ports below 1024 are well known, used for standard services
o SSH server listens to port 22
o FTP server listens to port 21
o Web or HTTP server listens to port 80
Carnegie Mellon
▪ Sockets
▪ Three types of sockets
o Connection-oriented (TCP)
o Connectionless (UDP)
o MulticastSocket class-data can be
sent to multiple recipients
Carnegie Mellon