Distributed System: Communication in DS
Distributed System: Communication in DS
Distributed System: Communication in DS
Chapter 4
Communication in DS
Objectives
•After accomplishing this chapter, Students will be able to understand:
Introduction to Communication
Network Protocols and Standards
Remote Procedure Call
Remote Object (Method) Invocation (RMI)
Message-Oriented Communication
Stream-Oriented Communication
Multicast Communication
What is Communication?
•Inter process communication is at the heart of all distributed systems.
•Communication in distributed systems is based on message passing as offered by the
underlying network which is harder as opposed to using shared memory.
•Unless the primitive communication facilities of the network are replaced by more
advanced ones, development of large scale Distributed Systems becomes extremely
difficult.
Network Protocols and Standards
•Break the data into small sections called packets (message, datagram, packet, frame).
•Add addressing information to the packets identifying the source and destination
computers.
•Deliver the data to the network interface card for transmission over the network.
Cont…
•The receiving computer must perform the same steps, but in reverse order.
Accept the data from the NIC,
Remove transmitting information that was added by the transmitting computer,
Reassemble the packets of data into the original message.
Syntax: refers to the structure or format of the data.
Semantics: refers to the meaning of each section of bits.
Timing: refers to when data should be sent and how fast they can be sent functions of protocols.
Network (Reference) Models
Layers and Services
•Within a single machine, each layer uses the services immediately below it and provides services
for the layer immediately above it.
•Between machines, layer x on one machine communicates with layer x on another machine.
•As an example we can call a function in a remote machine from our local computer
using RPC.
•RPC are essential to the development of distributed systems because they let programmers
extend the capabilities of conventional procedure calls across a network.
•The stub is an object, acts as a gateway for the client side and all the outgoing requests are
routed through it.
•It resides at the client side and represents the remote object and when the caller invokes method
on the stub object, it does the following tasks:
Cont…
Steps of a Remote Procedure Call
1)
Client procedure calls client stub in the 6. Server does the work and returns the result
normal way to the stub
2)
Client stub builds a message and calls the 7. Server stub packs it in a message and calls
local OS the local OS
3)
Client’s OS sends the message to the remote 8. Server’s OS sends the message to the
OS client’s OS
4)
Remote OS gives the message to the server 9. Client’s OS gives the message to the client
stub stub
5)
Server stub unpacks the parameters and calls 10. Stub unpacks the result and returns to
the server client
Cont…
Cont…
Socket Programming
•One socket(node) listens on a particular port at an IP, while other socket reaches
out to the other to form a connection. Server forms the listener socket while client
program, either on a remote or local machine and send messages back and forth.
Cont…
•In this application, client sends a message to the server, server reads the
message and prints it.
•Here, two classes are being used: Socket and Server Socket.
• The Socket class is used to communicate client and server through this
class, we can read and write message.
Cont…
of a well-defined interface.
Cont…
•RMI is the Java version of what is generally known as a remote procedure call
(RPC), but with the ability to pass one or more objects along with the request.
•The object can include information that will change the service that is
performed in the remote computer.
Cont…
•An object encapsulates data, called the state, and the operations on those data,
called methods
•Methods are made available through an interface and the state of an object
can be manipulated only by invoking methods.
•This allows an interface to be placed on one machine while the object itself
resides on another machine, such an organization is referred to as a distributed
object.
Cont…
Steps of RMI
Cont…
•If the state of an object is not distributed, but only the interfaces are, then such
an object is referred to as a remote object.
•IT is loaded into the client’s address space when a client binds to a distributed
object.
•RPCs and RMIs are not adequate for all distributed system applications.
•The provision of access transparency may be good but they have semantics that is
not adequate for all applications.
Example problems
•They assume that the receiving side is running at the time of communication.
•A client is blocked until its request has been processed messaging is the solution
Stream-Oriented Communication
•Until now, we focused on exchanging independent and complete units of information
•Time has no effect on correctness; a system can be slow or fast, however, there are communications where time has
a critical role.
Media
•Storage, transmission, interchange, presentation, representation and perception of different data types like text,
graphics, images, voice, audio, video, animation, ... movie: video + audio + …
• Technology push
As seen so far, Communication has concentrated on exchanging independent and complete
units of information.
Includes storage and transmission media, presentation media such as a monitor, and so on.
Asynchronous Transmission Mode: The data items in a stream are transmitted one after
the other, but there are no further timing constraints on when transmission of items should
take place.
Synchronous Transmission Mode: There is a maximum end-to-end delay defined for each
unit in a data stream.
Whether a data unit is transferred much faster than the maximum tolerated delay is not
important.
Multicast Communication
•Modern applications are required to handle and communicate an increasing amount of
data.
•Choosing among communication strategies, used for delivering message between entities,
therefore becomes crucial in order to efficiently utilize available resources.
•Systems where identical data is delivered to many recipients are common nowadays, but
may apply an underlying communication strategy based on direct interaction between