Chapter 3 IPC
Chapter 3 IPC
Inter Process
Communication
1
CONTENTS
Introduction.
3. Reliability:
A reliable communication is defined in terms of validity and integrity.
A point-to-point message service is described as reliable if messages
are guaranteed to be delivered despite a reasonable number of packets
being dropped or lost.
For integrity, messages must arrive uncorrupted and without
duplication.
4. Ordering:
Some applications require that messages be delivered in sender order.
5
Sockets
Sockets constitutes a mechanism for delivering incoming data
packets to the appropriate application process, based on a
combination of local and remote addresses and port numbers.
6
Sockets
7
Sockets (Cont. …)
Processes may use the same socket for sending and receiving
messages.
8
UDP Datagram Communication
UDP datagram properties
No guarantee of order preservation
Message loss and duplications are possible
Necessary steps
Creating a socket
Binding a socket to a port and local Internet address
A client binds to any free local port
A server binds to a server port
Receive method
It returns Internet address and port of sender, plus
message.
9
UDP Datagram Communication
10
UDP Datagram Communication
Blocking
Send: Non-blocking
• upon arrival, message is placed in a queue for the
socket that is bound to the destination port.
Receive: blocking
• Pre-emption by timeout possible
• If process wishes to continue while waiting for
packet, use separate thread
Timeout
an appropriate timeout interval
Receive from any
The receive method does not specify an origin for
messages.
11
TCP Stream Communication
TCP protocol provides the abstraction of a stream of
bytes to be written to or read from.
12
TCP Stream Communication
Message sizes: The application can choose how much data it writes to a
stream or reads from it. It may deal in very small or very large sets of data.
Lost messages: The TCP protocol uses an acknowledgement scheme. If the
sender does not receive an acknowledgement within a timeout, it retransmits
the message.
Flow control: The TCP protocol attempts to match the speeds of the
processes that read from and write to a stream. If the writer is too fast for the
reader, then it is blocked until the reader has consumed sufficient data.
Message duplication and ordering: Message identifiers are associated with
each IP packet, which enables the recipient to detect and reject duplicates, or
to re-order messages that do not arrive in sender order.
Message destinations: A pair of communicating processes establishes a
connection before they can communicate over a stream. Once a connection
is established, the processes simply read from and write to the destination.
13
External Data Representation
The information stored in running programs is represented as
data structures, whereas the information in messages consists
of sequences of bytes.
Irrespective of the form of communication used, the data
structure must be converted to a sequence of bytes before
transmission and rebuilt on arrival.
External Data Representation is an agreed standard for the
representation of data structures and primitive values.
Data representation problems are:
Using agreed external representation, two conversions necessary.
Using sender’s or receiver’s format and convert at the other end.
14
External Data Representation
Marshalling
Marshalling is the process of taking a
collection of data items and assembling them
into a form suitable for transmission in a
message.
Unmarshalling
Unmarshalling is the process of disassembling
a collection of data on arrival to produce an
equivalent collection of data items at the
destination.
15
16
External Data Representation
Three alternative approaches to external data representation and
marshalling
CORBA’s common data representation, which is concerned with
an external representation for the structured and primitive types
that can be passed as the arguments and results of remote method
invocations in CORBA.
18
Network Virtualization
Network virtualization is concerned with the construction of many
different virtual networks over an existing network such as the
Internet.
19
Overlay networks
An overlay network is a virtual network consisting of nodes
and virtual links.
Multiple overlays can be defined and can coexist, with the end
result being a more open and extensible network architecture.
21
Skype: An example of an overlay-
network
Skype is a peer-to-peer application offering Voice over IP
(VoIP). It also includes instant messaging, video conferencing
and interfaces to the standard telephony service through Skype
In and Skype Out.
22
Skype (Contd..)
Skype Architecture: Skype is based on a peer-to-peer
infrastructure consisting of ordinary hosts and super
nodes.
26