Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Distributed System: Communication in DS

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 36

DISTRIBUTED SYSTEM

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.

•Modern distributed systems consist of thousands of processes spread across an


unreliable network such as the Internet.

•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

•Why communication in distributed systems? because there is no shared


memory.

•Two communicating processes must agree on the syntax and semantics of


messages.

•A protocol is a set of rules that governs data communications.

•A protocol defines what is communicated, how it is communicated, and


when it is communicated.
Cont…
•One computer to send a message to another computer, the first computer must perform
the following general steps (highly simplified).

•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.

•The key elements of a protocol are syntax, semantics, and timing


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.

•Two important network models or architectures

•The ISO OSI (Open Systems Interconnection) Reference Model.

[A. The OSI Reference Model consists of 7 layers]


•Open to connect open systems or systems that are open for communication with other systems.
Cont…
Function of Each Layer
Remote Procedure Call(RPC)
•RPC stands for Remote Procedure Call which supports procedural programming.
•A Remote Procedure Call is an inter-process communication technique that is used
for client-server based applications and it is also known as a subroutine call or a
function call.

•As an example we can call a function in a remote machine from our local computer
using RPC.

•We can define RPC as a communication type in distributed systems.


•When we dig into RPC structure, we can identify it implements the client server
model.
Cont…

•The first distributed systems were based on explicit message


exchange between processes through the use of explicit send and
receive procedures, but do not allow access transparency.

•It allows a program to call a procedure located on another machine


and the calling and called procedures run in different address spaces.

•Parameters and results have to be exchanged, what if the machines


are not identical?
Cont…
•RPC is a powerful technique for constructing distributed, client-server based applications.
•It is based on extending the conventional local procedure calling so that the

called procedure need not exist in the same address space as the calling procedure.

•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

•Socket Programming is a way of connecting two nodes on a network to


communicate with each other.

•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

reaches out to the server.

•Sockets are a fundamental part of client-server networking and they provide a


relatively easy mechanism for a program to establish a connection to another

program, either on a remote or local machine and send messages back and forth.
Cont…

•Here, we are going to make one-way client and server communication.

•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…

• The Server Socket class is used at server-side.


• The accept() method of Server Socket class blocks the
console until the client is connected.

• After the successful connection of client, it returns the


instance of Socket at server-side.
Cont…
Cont…
Remote Method Invocation(RMI)

•The RMI (Remote Method Invocation) is an API that provides a


mechanism to create distributed application in java.

•The RMI allows an object to invoke methods on an object running


in another Java Virtual Machine (JVM).

•The RMI provides remote communication between the applications


using two objects stub and skeleton.
Cont…
•Resulted from object-based technology that has proven its
value in developing non distributed applications it is an

expansion of the RPC mechanisms.

•It enhances distribution transparency as a consequence of an


object that hides its internal from the outside world by means

of a well-defined interface.
Cont…

•RMI is a way that a programmer, using the Java programming language and


development environment, can write object-oriented programming in

which objects on different computers can interact in a distributed network.

•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.

•The implementation of an object’s interface is called a proxy (analogous to a


client stub in RPC systems).

•IT is loaded into the client’s address space when a client binds to a distributed
object.

•Tasks: a proxy marshals method invocation into messages and un marshals


reply messages to return the result of the method invocation to the client.
Message-Oriented Communication

•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 + …

Multimedia: Handling of a variety of representation media

• End user pull

• Information overload and starvation/Hunger

• Technology push

• Emerging technology to integrate media


Cont…

As seen so far, Communication has concentrated on exchanging independent and complete
units of information.

Stream-oriented communication is a form of communication in which timing plays a


crucial role. E.g. audio stream.

Support For Continuous Media • Medium - means by which information is conveyed.

Includes storage and transmission media, presentation media such as a monitor, and so on.

Temporal relationships between different data items are fundamental to correctly


interpreting what the data actually means.
Cont…
DATA STREAM: A data stream is nothing but a sequence of data units and Different
transmission modes:

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.

•For example, a file transferred as a data stream.


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.

•Meanwhile, distributed systems containing multiple computationally weak components


becomes more common, resulting in a problematic situation.

•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

sender and receiver which is insufficient.


Cont…

•Multicasting refers to a technique for group communication where


messages can be distributed to participating nodes in a single
transmission.

•This technique is developed to avoid the problem of high workload on


sender side and redundant traffic in the network, and constitutes the
focus.

•Multicasting refers to the communication paradigm where delivery of


messages goes from one sender to multiple receivers.
Cont…

•It has the benefit of providing message delivery to a


destination group in a single transmission, as messages are
replicated on network elements, i.e. routers and switches.

•This means that only one message needs to be sent on each


link in the network which can decrease the amount of
copies on the outgoing link for this thesis.
THANK YOU!!!
QUESTIONS???

You might also like