0% found this document useful (0 votes)
13 views35 pages

Chapter 4

Uploaded by

Legesse Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views35 pages

Chapter 4

Uploaded by

Legesse Samuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

CHAPTER 4-COMMUNICATION

1
INTRODUCTION
 Interprocess communication is at the heart of all
distributed systems.
 In a distributed system, processes run on different
machines and can only exchange information through
message passing;
 Modem distributed systems often consist of thousands
or even millions of processes scattered across a
network with unreliable communication 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
2
CONT…

 Successful distributed systems depend on


communication models that hide or simplify
message passing.
 Remote Procedure Call (RPC):
 which hides the details of message passing and
suitable for client-server models.
 Remote Object (Method) Invocation (RMI):
 it is an expansion of the RPC mechanisms

ƒit enhances distribution transparency.


 hides its internal from the outside world by
means of a well-defined interface.

3
CONT…

 Message-Oriented Middleware (MOM)


 instead of the client-server model, think in terms of

messages and have a high level message queuing


model similar to e-mail.
 Stream-Oriented Communication
 for multimedia to support the continuous flow of
messages with timing constraints
 Multicast Communication
 information dissemination for several recipients

4
4.1. LAYERED PROTOCOLS
 Due to the absence of shared memory, all
communication in distributed systems is based on
sending and receiving messages.
 two communicating processes must agree on the syntax
and semantics of messages.
 agreements are needed at a variety of levels, varying
from the low-level details of bit transmission to the
high-level details of how information is to be
expressed.

5
CONT…

 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
 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

6
CONT…

 two computers, possibly from different manufacturers,


must be able to talk to each other; for such a
communication, there has to be a standard.
 The ISO OSI (Open Systems Interconnection) Reference
Model is one of such standards - 7 layers
 TCP/IP protocol suite is the other; has 4 or 5 layers

7
OSI Model

 designed to allow open systems to communicate.


 an open system is one that is prepared to communicate
with any other open system by using standard rules
that govern the format, contents, and meaning of the
messages sent and received.
 these rules are called protocols

8
CONT…

9
layers, interfaces, and protocols in the OSI model
CONT…

10
CONT…

a typical message as it appears on the network 11


CONT…
 a conversation occurs between a sender and a receiver at
each layer. E.g., at the data link layer

12
discussion between a receiver and a sender in the data link layer
TCP/IP REFERENCE MODEL
oTCP/IP - Transmission Control Protocol/Internet Protocolƒ
used by ARPANET and its successor the Internet.
oƒdesign goals
ƒthe ability to connect multiple networks
(internetworking) in a seamless way
ƒthe network should be able to survive loss of subnet
hardware,
i.e., the connection must remain intact as long as the
source and destination machines are properly functioning
ƒflexible architecture to accommodate requirements of
different applications - ranging from transferring files to
real-time speech transmission
oƒthese requirements led to the choice of a packet-
switching network based on a connectionless internetwork
13
layer
CONT…

14
Middleware Protocols
o a middleware is an application that contains general-
purpose protocols to provide services
o example of middleware services
 authentication and authorization services
 distributed transactions (commit protocols; locking
mechanisms)
 middleware communication protocols (calling a
procedure or invoking an object remotely,
synchronizing streams for real-time data, multicast
services)
o hence an adapted reference model for networked
communications is required
15
CONT…
oCompared to the OSI model, the session and presentation
layer have been replaced by a single middleware layer that
contains application-independent protocols.

16

an adapted reference model for networked communication


4.2. TYPES OF COMMUNICATION
1. Persistent or Transient
 Persistent:
 a message that has been submitted for transmission is stored
by the communication system as long as it takes to deliver
it to the receiver. (i.e. the middleware will store the message
at one or several of the storage facilities)
 As a consequence:
 the sending application not need to continue execution after

submitting the message


 the receiving application need not be executing when the

message is submitted.

17
CONT…
 Transient:
 a message is stored by the communication system only as
long as the sending and receiving application are executing.
 the middleware cannot deliver a message due to a
transmission interrupt, or because the recipient is
currently not active, it will simply be discarded.
 all transport-level communication services offer only
transient communication.
 the communication system consists traditional store-and-
forward routers.
 if a router cannot deliver a message to the next one or the
destination host, it will simply drop the message.

18
CONT…
2. Asynchronous or Synchronous
 Asynchronous:
 a sender continues immediately after it has submitted its
message for transmission.
 This means that the message is (temporarily) stored
immediately by the middleware upon submission.

 Synchronous:
 the sender is blocked until its request is to be accepted
 Three points where synchronization can take place:
1. the sender may be blocked until the middleware notifies that
it will take over transmission of the request.
2. the sender may synchronize until its request has been

delivered to the intended recipient.


3. synchronization may take place by letting the sender wait
19
until its request has been fully processed
CONT…

3. Discrete or streaming
 Discrete:
 the parties communicate by messages, each message forming
a complete unit of information.
 Streaming:
 involves sending multiple messages, one after the other,
where the messages are related to each other by the order
they are sent or because there is a temporal relationship.

20
4.3 REMOTE PROCEDURE CALL

 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
 in 1984, Birrel and Nelson introduced a different way
of handling communication: RPC
 it allows a program to call a procedure located on another
machine
 simple and elegant, but there are implementation problems
 the calling and called procedures run in different address
spaces
 parameters and results have to be exchanged

21
1. Conventional Procedure Call, i.e., on a single machine
 e.g. count = read (fd, buf, bytes); a C like statement, where
fd is an integer indicating a file
buf is an array of characters into which data are read
bytes is the number of bytes to be read
Stack
pointer

Stack
pointer

parameter passing in a local procedure the stack while the called procedure
call: the stack before the call to read is active

 parameters can be call-by-value (fd and bytes) or call-by 22


reference (buf) or in some languages call-by-copy/restore
 Client and Server Stubs
 RPC would like to make a remote procedure call look the
same as a local one; it should be transparent, i.e., the
calling procedure should not know that the called procedure
is executing on a different machine or vice versa

principle of RPC between a client and server program


 when a program is compiled, it uses different versions of
library functions called client stubs
 a server stub is the server-side equivalent of a client stub,
23
it is a piece of code that transforms requests coming in over
the network into local procedure calls.
 Steps of a Remote Procedure Call

1. Client procedure calls client stub in the normal way


2. Client stub builds a message and calls the local OS
(packing parameters into a message is called parameter
marshaling)
3. Client's OS sends the message to the remote OS
4. Remote OS gives the message to the server stub
5. Server stub unpacks the parameters and calls the server
6. Server does the work and returns the result to the stub
7. Server stub packs it in a message and calls the local OS
8. Server's OS sends the message to the client's OS
9. Client's OS gives the message to the client stub
10. Stub unpacks the result and returns to client

 hence, the client remote services are accessed by making


24
ordinary (local) procedure calls; not by calling send and
receive
2. Parameter Passing
a. Passing Value Parameters
 e.g., consider a remote procedure add(i, j), where i and j
are integer parameters

25

steps involved in doing remote computation through RPC


b. Passing Reference Parameters
 assume the parameter is a pointer to an array
 copy the array into the message and send it to the server
 the server stub can then call the server with a pointer to
this array
 the server then makes any changes to the array and sends it
back to the client stub which copies it to the client
 this is in effect call-by-copy/restore
 optimization of the method
 one of the copy operations can be eliminated if the stub
knows whether the parameter is input or output to the
server
 if it is an input to the server (e.g., in a call to write), it
need not be copied back
 if it is an output, it need not be sent over in the first
place; only send the size
 the above procedure can handle pointers to simple arrays and 26
structures, but difficult to generalize it to an arbitrary data
structure
3. Asynchronous RPC
 if there is no need to block the client until it gets a reply
 two cases
a. if there is no result to be returned
 e.g., adding entries in a database, ...
 the server immediately sends an ack promising that it
will carryout the request
 the client can now proceed without blocking

27
a) the interconnection between client and server in a traditional RPC
b) the interaction using asynchronous RPC
b. if the result can be collected later
 e.g., prefetching network addresses of a set of hosts, ...
 the server immediately sends an ack promising that it
will carryout the request
 the client can now proceed without blocking
 the server later sends the result

28

a client and server interacting through two asynchronous RPCs


4.3 REMOTE OBJECT (METHOD) INVOCATION (RMI)
 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
 Distributed Objects
 an object encapsulates data, called the state, and the
operations on those data, called methods
 methods are made available through interfaces
 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 29
CONT…

 the state of an object is not distributed, only the


interfaces are; such objects are also referred to as
remote objects
 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 unmarshals reply messages to return the result of
the method invocation to the client.
 a server stub, called a skeleton, unmarshals
messages and marshals replies 30
CONT…

31
common organization of a remote object with client-side proxy
 Binding a Client to an Object

 a process must first bind to an object before invoking


its methods, which results in a proxy being placed in
the process’s address space
 binding can be implicit (directly invoke methods using
only a reference to an object) or explicit (by calling a
special function)
 an object reference could contain
 network address of the machine where the object
resides
 endpoint of the server
 an identification of which object
 the protocol used
 ... 32
 Parameter Passing

 there are two situations when invoking a method with


object reference as a parameter: the object can be local
or remote to the client
 local object: a copy of the object is passed;
 this means the object is passed by value
 remote object: copy and pass the reference of the
object as a value parameter;
 this means the object is passed by reference

33
CONT…

the situation when passing an object by reference or by value


34
END

35

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy