7/9/2020
INTE 321/COMP 322
DISTRIBUTED SYSTEMS
Lecture 3: Communication in Distributed
Systems
Prof S Karume
1
7/9/2020
Presentation Outline
• Review of lecture 2
• Communication in DS (videos – 50
minutes)
2
7/9/2020
Review of Lesson 2
• What is a client server architecture in distributed systems
3
7/9/2020
Introductory videos
• https://www.youtube.com/watch?v=GTP0KOsLAyA
4
7/9/2020
Communication Paradigms
• Communication Paradigms
• Using the Network Protocol Stack
• Remote Procedure Call - RPC
• Remote Object Invocation - Java
• Remote Method Invocation
• Message Queuing Services - Sockets
• Stream-oriented Services
5
7/9/2020
Internet Applications Serving Local and
Remote Users
6
7/9/2020
TCP Connection Overhead
7
7/9/2020
REMOTE PROCEDURE CALL
RPC
8
7/9/2020
Conventional Procedure Call
a) Parameter passing in a
local procedure call: the
stack before
the call to read.
b) The stack while the called
procedure is active.
9
7/9/2020
Remote Procedure Call
• RPC concept :: to make a remote procedure call appear
like a local procedure call.
• The goal is to hide the details of the network
communication (namely, the sending and receiving of
messages).
• The calling procedure should not be aware that the called
procedure is executing on a different machine.
10
10
7/9/2020
RPC differs from OSI
• User does not open connection, read, write, then close
connection – client may not even know they are using the
network.
• RPC may omit protocol layers for efficiency. (e.g. diskless
Sun workstations will use RPC for every file access.)
• RPC is well-suited for client-server interaction where the
flow of control alternates.
11
11
7/9/2020
RPC between Client and
server
12
12
7/9/2020
RPC STEPS
1. The client procedure calls a client stub passing parameters
in the normal way.
2. The client stub marshals the parameters, builds the
message, and calls the local OS.
3. The client's OS sends the message (using the transport layer)
to the remote OS.
4. The server remote OS gives transport layer message to a
server stub.
5. The server stub demarshals the parameters and calls the
desired server routine.
13
13
7/9/2020
RPC STEPS
• 6The server routine does work and returns result to
• the server stub via normal procedures.
• 7. The server stub marshals the return values into the
message and calls local OS.
• 8. The server OS (using the transport layer) sends the
message to the client's OS.
• 9. The client's OS gives the message to the client stub
• 10. The client stub demarshals the result, and execution
returns to the client.
14
14
7/9/2020
RPC STEPS
15
15
7/9/2020
Passing Value Parameters
a) Original message on the Pentium
b) The message after receipt on the SPARC
c) The message after being inverted. The little numbers in boxes indicate
the address of each byte
16
16
7/9/2020
Marshaling Parameters
Parameters must be marshaled into a
standard representation.
! Parameters consist of simple types (e.g. integers) and
compound types (e.g., C structures).
! The type of each parameter must be known to the
modules doing the conversion into standard representation.
17
17
7/9/2020
Marshaling Parameters
• Call-by-reference is not possible in parameter passing.
• It can be “simulated” by copy-restore. A copy of the
referenced data structure is sent to the server, and upon
return to the client stub the client’s copy of the structure is
replaced with the structure modified by the server.
• However, in general marshaling Cannot handle the case of a
pointer to an arbitrary data structure such as a complex
graph.
18
18
7/9/2020
Parameter Specification
and Stub Generation
The caller and the callee must agree
on the format of the message they
exchange, and they must follow the same
steps when it comes to passing complex
data structures.
19
19
7/9/2020
RPC Details
• An Interface Definition Language (IDL) is used to specific the interface
that can be called by a client and implemented by the server.
• All RPC-based middleware systems offer an IDL to support application
development.
20
20
7/9/2020
Doors • The principle of using
doors as IPC mechanism
21
21
7/9/2020
Doors
• A Door is a generic name for a procedure in the
address space of a server process that can be
called by processes colocated with the server.
• Doors require local OS support.
22
22
7/9/2020
Asynchronous RPC
•.
a) The interconnection between client and server in a traditional
RPC
b) The interaction using asynchronous RPC
23
23
7/9/2020
Asynchronous RPC
A client and server interacting through two asynchronous
RPCs
24
24