salimi-distributed systems -...
TRANSCRIPT
Lecturer: Hadi SalimiLecturer: Hadi Salimi
Distributed Systems Lab,
School of Computer Engineering
I U i i f S i d T h lIran University of Science and Technology,
IntroductionInter‐Process Communication (IPC) is the heart of distributed systems.
The underlying technology to support communication is the network technology.the network technology.
Unlike simple passing of data packets on a network, p p g pdistributed systems need more advanced communication styles, such as:
Remote Procedure Calls (RPCs)Remote Procedure Calls (RPCs)
Message Passing (MOMs)
Streaming
…
Layered ProtocolsDue to the lack of shared memory, communication in distributed systems is performed using message passing.
It means:
A process prepares its data in a buffer
Then it executes a system call.
And the same for the receiver.
Many agreements need to communicate:
From the way data is expressesFrom the way data is expresses.
…
To the voltage for representing 0 or 1.g p g
ISO OSI
Layers, interfaces, and protocols in the OSI model
Layered Protocols
A typical message as it appears on the networkA typical message as it appears on the network
Types of Communication
Consider a e‐mail system
Take the whole system as a middlewareC i ti i i t t Communication is persistent
Communication is asynchronous
Remote Procedure CallsIn 1984, Barrel and Nelson, proposed the idea of Remote Procedure Calls (RPCs).
Allowing processes to call functions available on other h machines.
Th RPC h h llThe RPC, has many challenges:
Processes run on different address spaces.
Platforms may differPlatforms may differ.
…
ExampleConsider a case which is a call to a function:
Count = read(fd , buf , nbytes)f f y
The simply reads a file fd into a buffer.
nbytes show that how many buffers has been read.
See the status of stack after this call.
Stack State
The stack after calling the read procedure.
Any comments about the order of parameters?y p
Parameter PassingSome parameters the previous example are passed by value and some by reference.
In addition, some languages use call by copy/restore. Do you know what is it?you know what is it?
They are important for C programmers. y p p g
They are important for RPC designers as well.
In addition, different languages use different calling styles styles.
StepsThe client procedure calls the client stub in the normal way.
The client stub builds a message and calls the local operating system.
The client’s OS sends the message to the remote OS.
Th t OS i th t th t bThe remote OS gives the message to the server stub.
The server stub unpacks the parameters and calls the server.
The server does the work and returns the result to the stubThe server does the work and returns the result to the stub.
The server stub packs it in a message and calls its local OS.
The server’s OS sends the message to the client’s OS.g
The client’s OS gives the message to the client stub.
The stub unpacks the result and returns to the client.
Stubs
A RPC should seem like an ordinary call to users.
Client and server stubs bring this transparency for users Client and server stubs bring this transparency for users.
This example is a synchronous communication.
Parameter PassingThe client stub should pack the parameters and send them to the sever.
Passing ParametersA big challenge in parameter passing is the different representation of words on different machines.
See what happens in passing See what happens in passing two words from a Pentium architecture to SPARC.
Passing by ReferenceWhat is the problem with passing pointers to a remote machine?
To emulate this call by reference, we should copy the h l b ff d d h k whole array to a buffer and send it over the network.
I i d id ?Is it a good idea?
Wh t b t i t t bi d t t t lik h?What about a pointer to a big data structure, like a graph?
Parameter SpecificationThe client and server should agree with the specification of messages.
h h ld b h d This should be reached using client and server stubs.
As you will see, client and server stub could be generated using a stub could be generated using a compiler.
Example: DCE RPC
A QuestionWhy in a IDL, the input, output and input‐output parameters should be specified explicitly?
Asynchronous RPCThere is no need to block the client, when no result is going to be returned.
Traditional RPC Asynchronous RPC
Deferred Synchronous RPCIn many cases, the server returns a result, but the client cannot wait it.
This could happen using two asynchronous calls.
Client Server Binding in DCE
Client‐Server Binding in DCE
RMILike RPC, Remote Method Invocation (RMI) is a special calling between distributed objects.
Some languages such as Java, support this feature.
The same techniques described for RPC, such as IDLs and t b lid f RMI t stubs are valid for RMI too.
Message PassingRPC and RMI could provide transparency for communication challenge of distributed systems.
But unfortunately, the both sides should be executing at h the same time.
T l hi i h i h l ld b To solve this issue, the messaging technology could be helpful.
Sockets
Primitives of a TCP/IP socket Primitives of a TCP/IP socket.
Communication by Sockets
Communication using sockets
SocketsPros:
Too simple
Are efficient
Cons:
Not too abstract
Lack most needs of today’s HPC environments
A t l ifiAre protocol specific
MPIThe need for a hardware and platform independent programming interface, led to standardization of Message Passing Interface or MPI Passing Interface or MPI.
In this standard, each process could be represented by a In this standard, each process could be represented by a tuple, namely, (GroupId , ProcessId)
This standard includes more than 100 primitives for:Scattering data
Gathering dadaGathering dada
Getting the group id
…
MPI Primitives
Some basic primitives of MPI
Message QueuingThey provide support for persistent communication.
The underlying middleware is usually called a Message Oriented Middleware or MOM.
The simple idea is to put the message for another process i Th i ill i k th in a queue. The receiver will pick up the message as soon as it become online.
Message‐Queuing Model (1)
Loosely coupled communication by Loosely coupled communication by means of message queues
Interface of MOMs
The basic primitives for a message queuing system
Queue Level addressing
Th i i hi h d t The scenario in which a process send a message to another queue.
General Architecture
General architecture of a message queuing system with g q g yrouters
Message BrokersAn important application area of message‐queuing systems is integrating new and legacy applications.
It needs they have the same message format.
Two approaches could be applied:
d d fAgree on a standard format
Use a message broker
Message Brokers
General organization of a message broker used in message g g gqueuing systems.
Some NotesThe idea of message queuing systems has long been used in email systems.
But there are differences:
In email systems routing is generally left out
In addition, they are aimed at providing direct support for end users end users.
There are special features in message queue systems that There are special features in message queue systems that there is no need for them in email systems, such as message priorities or guaranteed message delivery.
Data StreamsThere are forms of communication in which timing plays a crucial role.
As an example, suppose that an audio stream should be transferred through a communication channel.
Playing out in a different rate, will produce and incorrect version of the original sound. g
The same is true for a video clip in which at least 20‐25 frames should be displayed in a second should be displayed in a second.
For discrete media, i.e. images and text this is not true, but for ti di thi i lid continuous media this is valid.
Stream TransmissionAsynchronous:
Data items are transmitted one after another and there are f th ti t i tno further time constraints.
File transmission
Synchronous:Synchronous:There is always a maximum end‐to‐end delay.
Sensor Data or DSMSs
Isochronous: Data transfer is subject to a ma imum and minimum dela Data transfer is subject to a maximum and minimum delay, also referred t as bounded delay (jitter).
Audio and video streams
StreamsSimple:
Consists only one sequence of data.
A non‐stereo audio stream
Complex:
Consists of several simple streams, called sub‐streams
S f id d b i l Streams of video, sound, subtitle, etc.
General Architecture
General architecture of a data streaming systemGeneral architecture of a data streaming system
QoS ParametersProperties for Quality of Service:
The required bit rate at which data should be transported.
The maximum delay until a session has been set up
The maximum end‐to‐end delayThe maximum end‐to‐end delay.
The maximum delay variance, or jitter.
The maximum round‐trip delay.
Enforcing QoSNo one can guarantee a specific QoS on internet.
So, the underlying systems offer only a best‐effort delivery y g y y yservice.
Marking outgoing packets by priorities
Packet dropping policies for network congestion control.
Using buffers for continuous data delivery.
Data buffering
U i b ff d jiUsing buffer to reduce jitter.
Enforcing QoS
h ff f k l i ( ) i l d i i The effect of packet loss in (a) non interleaved transmission and (b) interleaved transmission
Stream SynchronizationBetween a discrete and continuous stream
An slide‐show on the web
Between two continuous streams
A vide clip on the web
Is happens at data unit a stream is made up.
Diff d d f d f i d Different standards for stream data frequencies and synchronization points exist, such as NTSC.
Stream Synchronization
Stream h i ti synchronization
at different levels of a computer psystem.