You are on page 1of 23

Chapter 4- Communication

Interprocess communication (IPC) is a set of programming


interfaces that allow a programmer to coordinate activities among different
program processes that can run concurrently in an operating system. This
allows a program to handle many user requests at the same time.
OR
Inter-process communication (IPC) is the activity of sharing data across
multiple and commonly specialized processes using communication
protocols. Typically, applications using IPC are categorized as clients and
servers, where the client requests data and the server responds to client
requests. Many applications are both clients and servers, as commonly seen
in distributed computing. Methods for achieving IPC are divided into
categories which vary based on software requirements, such
as performance and modularity requirements, and system circumstances,
such as network bandwidth and latency.
A communications protocol defines the rules for sending
blocks of data (each known as a Protocol Data Unit (PDU))
from one node in a network to another node. Protocols are
normally defined in a layered manner and provide all or part of
the services specified by a layer of the OSI reference model.
 Lower-level protocols
o Physical – deals with mechanical and electrical details
o Data link – groups bits into frames & ensure are correctly received
o Network – describes how packet are routed, lowest i/f for most distributed systems (IP)
 Transport protocols
Transfer messages between clients, including breaking them into packets etc (TCP)
 High-level protocols
o Session – provides dialog control and synchronization
o Presentation – resolves differences in formats among sites
o Application – originally to contain a set of standard apps
 Middleware protocols
Basically an “application” providing general-purpose, high-level protocols that can be used by others
– Rich set of communication protocols
– (Un)marshaling of data
– Naming protocols so that different apps can share resources
– Security protocols
– Scaling mechanisms such as support for replication and caching
Layer Data unit Functio Examples
High-level APIs, including resource sharing, remote file HTTP, FTP, SMT
7. Application
access, directory services and virtual terminals P

Translation of data between a networking service and an


ASCII, EBCDIC,
6. Presentation application; including character encoding, data compression
Data JPEG
and encryption/decryption
Host
layers Managing communication sessions, i.e. continuous
5. Session exchange of information in the form of multiple back-and- RPC, PAP
forth transmissions between two nodes
Reliable transmission of data segments between points on a
4. Transport Segments network, including segmentation, acknowledgement TCP, UDP
and multiplexing
Structuring and managing a multi-node network, including IPv4, IPv6, IPsec,
3. Network Packet/Datagram
addressing, routing and traffic control AppleTalk
Media Reliable transmission of data frames between two nodes PPP, IEEE
layers 2. Data link Bit/Frame
connected by a physical layer 802.2, L2TP
Transmission and reception of raw bit streams over a
1. Physical Bit DSL, USB
physical medium
 Message oriented communication
– Message-oriented transient communication
– Message-oriented persistent communication
 Stream oriented communication
-Asynchronous Transmission: Streams transmitted one after the
other (i.e. no constraint on when transmission should take place)
-Synchronous Transmission: A maximum end-to-end delay is
defined
 Multicast Communication
-sending data to multiple receivers simultaneously
 Persistent communication
◦ Message being submitted is stored as long as it takes to deliver it.
◦ The sending application can exit after submitting
◦ The receiving application does not have to be active
 Transient communication
◦ message is stored as long as the sending/receiving is executing
◦ if fails due to transmission problem or unavailable of the receipt, the
message will be just dropped
 Asynchronous communication
◦ Sender continues immediately after submitting a message
 Synchronous communication
◦ Sender will wait until it is certain that the message is received
 Discrete communication /steaming communication
◦ Each message is a complete unit of info. or part of whole
 In computer networking, multicasting (one-to-many or many-to-many
distribution) is group communication where information is addressed to
a group of destination computers simultaneously.
 One sender and a group of known receivers.
 The sender does not address its message to every host that will
eventually receive it.
 Multicasting is broader then unicasting and narrower then broadcasting.
This is like a public meeting.
 Examples:-
◦ Audio, Video conferencing applications.

Applications:-

An application simply sends datagram packets to a multicast address,


which isn’t fundamentally different from any other IP Address. The router
make sure the packet is delivered to all the hosts in the multicast group
The biggest problem is that multicast router are not yet ubiquitous(found
everywhere), therefore, you need to know enough about them to find out
whether multicasting is supported on your network.
There are two models that are widely accepted to develop
distributed operating system.

– Message Passing Model


– Remote procedure call (RPC)
 A means to send raw bit streams of data in distributed
environment
The Message Passing model provides two basic
communication Primitives
 The Send Primitives has two parameters: – A message
and its destination.
 The Receive Primitive has also two parameters: – The
source of a message and a buffer for storing the
message.
 Blocking Primitive (Synchronous)
 Non Blocking Primitive(Asynchronous)
(sometimes called synchronous primitives).
When a process calls send it specifies a destination and a
buffer to send to that destination. While the message is being
sent, the sending process is blocked. (The instruction
following the call to send is not executed until the message
has been completely sent, Similarly, a call to receive does not
return control until a message has actually been received and
put in the message buffer. The process remains suspended in
receive until a message arrives, even if it takes hours. In some
systems, the receiver can specify from whom it wishes to
receive, in which case it remains blocked until a message
from that sender arrives.
An alternative to blocking primitives are non-blocking
primitives (sometimes called asynchronous primitives).
If send is non-blocking, it returns control to the caller
immediately, before the message is sent. The advantage of
this scheme is that the sending process can continue
computing in parallel with the message transmission, instead
of having the CPU go idle (assuming no other process is
runnable). The choice between blocking and non-blocking
primitives is normally made by the system designers.
Remote Procedure Call (RPC) inter-process communication that one
program can use to request a service from a program located in another
computer in a network without having to understand network details. (A
procedure call is also sometimes known as a function call or a subroutine
call.) RPC uses the client/server model. RPC makes the client/server model
of computing more powerful and easier to program
It is based on extending the notion of conventional, or local procedure
calling, so that the called procedure need not exist in the same address
space as the calling procedure. The two processes may be on the same
system, or they may be on different systems with a network connecting
them. By using RPC, programmers of distributed applications avoid the
details of the interface with the network. The transport independence of
RPC isolates the application from the physical and logical elements of the
data communications mechanism and allows the application to use a variety
of transports..
RPC works as a function call. Like a function call, when an RPC is made, the
calling arguments are passed to the remote machine and the caller waits for a
response to be returned from the remote machine. The below figure shows the
flow of activity that takes place during an RPC call between two networked
machines The client machine makes a procedure call that sends a request which
included program number, version number, procedure number & etc to the server
and waits. The thread is blocked from processing until either a reply is received,
or it times out. When the request arrives, the remote machine calls a dispatch
routine that performs the requested service, and sends the reply back to the client
procedure. After the RPC call is completed, the client program continues.

Example:
A client system connected to a database server may execute an RPC to process
data on the server. For example, a computer without a hard drive may use an RPC
to access data from a network file system (NFS). When printing to a network
printer, a computer might use an RPC to tell the printer what documents to print.
1. The client procedure calls the client stub in the normal way.
2. The client stub builds a message and calls the local OS.
3. The client’s OS sends the message to the remote OS.
4. The remote OS gives the message to the server stub.
5. The server stub unpacks the parameters and calls the server
6. The server does the work and returns the result to the stub.
7. The server stub packs it in a message and calls its local OS.
8. The server’s OS sends the message to the client’s OS.
9. The client’s OS gives the message to the client stub.
10.The stub unpacks the result and returns to the client.
Advantages of RPC:

 Server independent
 Process-oriented and thread oriented models supported by RPC
 The development of distributed systems is simple because it uses straightforward semantics
and easier.
 Like the common communications between the portions of an application, the development of
the procedures for the remote calls is quite general.
 The code re-writing / re-developing effort is minimized.
 Enables the usage of the applications used in the distributed environment, not only in the
local environment.

Disadvantages of RPC:

 Context switching increases scheduling costs


 RPC is not a standard – it is an idea that can be implemented in many ways
 Machine can crash
– what happens if you call a remote procedure and the remote machine crashes before returning?
 Procedures reside on different machines
– This means we cannot simply jump to the start of the procedure
– We need to use network communication techniques to interact with the remote machine.
Serialization is the process of translating object state into a
format that can be stored and reconstructed later in the same or
another computer environment (for example, stored in file or
memory buffer, or transmitted across a network connection
link).
When the resulting series of bits is reread according to the
serialization format, it can be used to create a semantically
identical clone of the original object. For many complex
objects, such as those that make extensive use of references,
this process is not straightforward. This process of serializing
an object is also called marshaling an object. The opposite
operation, extracting a data structure from a series of bytes, is
deserialization (which is also called unmarshaling).
The operation of data presentation conversion for further
network passing is known as marshaling. we can say about
marshaling for passing data in network without restriction of
the task.
OR
Marshalling or Marshaling is the process of transforming the
memory representation of an object to a data format suitable
for storage or transmission, and it is typically used when data
must be moved between different parts of a computer program
or from one program to another. Marshaling is similar
to serialization and is used to communicate to remote objects
with an object, in this case a serialized object. It simplifies
complex communication, The opposite, or reverse, of
marshalling is called unmarshalling
 A network socket is an endpoint of an inter-process
communication across a computer network. Today, most
communication between computers is based on the
Internet Protocol; therefore most network sockets are
Internet sockets.
 A socket API is an application programming interface(API),
usually provided by the operating system, that allows
application programs to control and use network sockets.
 A socket address is the combination of an IP address and
a port number, much like one end of a telephone
connection is the combination of a phone number and a
particular extension. Based on this address, internet
sockets deliver incoming data packets to the appropriate
application process or thread.
 The Internet Protocol is used in concert with
other protocols within the Internet Protocol Suite.
Prominent members of which include:
 Transmission Control Protocol (TCP)
 User Datagram Protocol (UDP)
 Internet Control Message Protocol (ICMP)
 Hypertext Transfer Protocol (HTTP)
 Post Office Protocol (POP)
 File Transfer Protocol (FTP)
 Internet Message Access Protocol (IMAP)
 MODBUS
 UDP (User Datagram Protocol) is a
communications protocol that offers a limited
amount of service when messages are exchanged
between computers in a network that uses the
Internet Protocol (IP). UDP is an alternative to the
Transmission Control Protocol (TCP) and,
together with IP, is sometimes referred to
as UDP/IP.

 A datagram is a basic transfer unit associated


with a packet-switched network. The delivery,
arrival time, and order of arrival need not be
guaranteed by the network.

You might also like