Professional Documents
Culture Documents
Communication
Communication
Communication
Outline
Introduction
Communication Issues
Layered Models (the OSI Model and the Internet Suite
Protocol)
Middleware Protocols
Introduction
Introduction (2)
Message Passing
Problems:
What if A uses ASCII character coding and B uses EBCDIC
character coding?
What if machine A represents a 0 using -5V, and machine B
represents a 0 using 0V?
What if machine A uses little endian notation to represent
numbers and B uses big endian?
What if the message is lost?
And so on
Agreements are needed at a variety of levels, ranging from the
low-level details of bit transmission to the high-level details of
how information is to be expressed
Solution: Layered Protocols (e.g. the OSI Model)
J.P. Carvalho
Communication Issues
Addressing (How is the server located?)
Hard-wired address
Machine address and process
address are known a priori
Broadcast-based
Server chooses address from a
sparse address space
Client broadcasts request
Can cache response for future
Locate address via name server
J.P. Carvalho
user
server
user
server
NS
user
server
Connection oriented:
Before exchanging data, the sender and the receiver
explicitly establish a connection (possibly negotiating
the protocol they will use);
The connection is released when all communication is
done;
E.g.: Telephone; ATM.
Connectionless:
No setup is needed in advance. The sender just
transmits the first message when its ready;
E.g.: e-mail, IP.
J.P. Carvalho
J.P. Carvalho
J.P. Carvalho
user
server
user
server
J.P. Carvalho
reply
ACK
request
reply
Server
ACK
Server
User
request
User
Unreliable channel
Need acknowledgements
(ACKs)
Applications handle ACKs
ACKs for both request and
reply
Reliable channel
Reply acts as ACK for request
Reliable communication on
unreliable channels
Transport protocol handles lost
messages
10
OSI Model
ISO Open Systems Interconnection Reference Model:
J.P. Carvalho
11
J.P. Carvalho
12
J.P. Carvalho
13
Network Layer
J.P. Carvalho
15
a) TCP
b) T/TCP
J.P. Carvalho
16
Presentation Layer
Is concerned with the meaning of the bits (e.g., structured info like
peoples name, address, etc.)
Application Layer
Intended for standard network applications like e-mail, file transfer and
terminal emulation
Currently is the container for all the applications that do not fit into one
of the underlying layers
Middleware Protocols
Middleware Protocols
J.P. Carvalho
18
J.P. Carvalho
19
20
21
RPC (2)
Client and Server Stubs
J.P. Carvalho
22
RPC (3)
Client and Server Stubs (cont.)
J.P. Carvalho
23
RPC (4)
Steps of a Remote Procedure Call
1. Client procedure calls client stub in normal way
2. Client stub builds message, calls local OS
3. Client's OS sends message to remote OS
4. Remote OS gives message to server stub
5. Server stub unpacks parameters, calls server
6. Server does work, returns result to the stub
7. Server stub packs it in message, calls local OS
8. Server's OS sends message to client's OS
9. Client's OS gives message to client stub
10. Stub unpacks result, returns to client
J.P. Carvalho
24
RPC (5)
Example: Passing parameters on a RPC
2-8
J.P. Carvalho
25
RPC (6)
Marshalling and Parameter Passing
Marshalling: Transform parameters into a byte stream (aka parameter packaging)
Problem: different machines have different data formats (e.g. Intel uses little
endian, SPARC uses big endian)
Solution: Use a standard representation (e.g. external data representation
XDR)
Parameter Passing
Call-by-value parameters:
Pass a copy to the client stub
Call-by-reference parameters (pointers):
If parameter points to a well-defined data structure, pass a copy to the
client stub and the server stub passes a pointer to the local copy. Then the
server returns the altered structure which replaces the client one
Problem: What about data structures containing pointers?
Solution:
Prohibit, or:
Chase pointers over network (implies additional communication
between server and client).
J.P. Carvalho
26
RPC(7)
Parameter Specification and Stub Generation
RPCs require that both sides must follow the same protocol. The
caller and the callee must:
Agree on the format of the messages they exchange;
Follow the same steps when, for example, passing complex
data structures;
Agree on the representation of simple data structures (e.g.,
integers, chars, booleans, etc., and internal data
representation);
Agree on the actual exchange of messages (e.g., use a
connection oriented protocol, like TCP/IP, or a
connectionless like UDP).
After protocol definition, Stubs must be implemented:
IDL Interface Definition Language
IDL considerably simplifies RPC based client-server
applications
J.P. Carvalho
27
RPC(8)
E.g.: Parameter Specification
a)
b)
A procedure
The corresponding message
J.P. Carvalho
28
RPC(9)
Binding: How does a client locate a server?
Use Bindings
Server
Export server interface during initialization
Send name, version no, unique identifier, handle (address) to
binder
Client
First RPC: send message to binder to import server interface
Binder: check to see if server has exported interface
Return handle and unique identifier to client
Exporting and importing binders incurs overheads
Binder can be a bottleneck
Use multiple binders
Binder can do load balancing
J.P. Carvalho
29
Lightweight RPCs
Lightweight RPCs
30
Lightweight RPCs
DOORS
31
Deferred-synchronous RPC
Client needs a reply but cant wait for it; server sends reply
via another asynchronous RPC (i.e., communication uses two
asynchronous RPCs)
One-way RPC
Client does not even wait for an ACK from the server
Limitation: reliability not guaranteed (client does not know if
procedure was executed by the server).
J.P. Carvalho
32
Asynchronous RPC
a)
b)
J.P. Carvalho
33
J.P. Carvalho
34
35
J.P. Carvalho
36
J.P. Carvalho
37
J.P. Carvalho
38
J.P. Carvalho
39
J.P. Carvalho
40
J.P. Carvalho
41
42
J.P. Carvalho
43
J.P. Carvalho
44
45
J.P. Carvalho
46
J.P. Carvalho
47
J.P. Carvalho
48
Java RMI
Java Remote Method Invocation
Server
Defines interface and implements interface methods
Server program
Creates server object and registers object with
remote object registry
Client
Looks up server in remote object registry
Uses normal method call syntax for remote methods
Java tools
Rmiregistry: server-side name server
Rmic: uses server interface to create client and server
stubs
J.P. Carvalho
49
Java RMI(2)
Synchronization
50
Java RMI(3)
Remote object invocation
J.P. Carvalho
51
52
J.P. Carvalho
53
Persistence
Persistent communication
Messages are stored until communication with next
receiver is possible
Examples: email, pony express
J.P. Carvalho
54
Transient Communication
Transient communication (the opposite of persistent
communication)
Message is stored only so long as sending/receiving
application are executing
Discard message if it cant be delivered to next
server/receiver
Example: transport-level communication services offer
transient communication
Example: Typical network router discard message if
it cant be delivered next router or destination
J.P. Carvalho
55
Synchronicity
Asynchronous communication
Sender continues immediately after it has submitted the
message
Need a local buffer at the sending host
Synchronous communication
Sender blocks until message is stored in a local buffer at
the receiving host or actually delivered to the receiver
Variant: block until receiver processes the message
Six combinations of persistence and synchronicity
J.P. Carvalho
56
2-22.1
J.P. Carvalho
57
J.P. Carvalho
58
J.P. Carvalho
59
J.P. Carvalho
60
Meaning
Create a new communication endpoint
Bind
Listen
Accept
Connect
Write
Read
Close
J.P. Carvalho
61
Hardware independent
Designed for parallel applications (uses transient communication)
Key idea: communication between groups of processes
Each endpoint is a (groupID, processID) pair
MPI primitives implement the most relevant transient/synchronicity
combinations
J.P. Carvalho
62
Meaning
MPI_bsend
MPI_send
MPI_ssend
MPI_sendrecv
MPI_isend
MPI_issend
MPI_recv
MPI_irecv
J.P. Carvalho
63
64
Primitive
Meaning
Put
Get
Block until the specified queue is nonempty, and remove the first
message
Poll
Check a specified queue for messages, and remove the first. Never
block.
65
66
67
J.P. Carvalho
68
J.P. Carvalho
69
Flow specification:
Characteristics of the Input
Service Required
Token buckets are used to specify how the stream will shape its network traffic
Parameters (rate r, burst b, token size k )
Rate is the average rate tokens are added to bucket, burst is the maximum
number of packets that can arrive simultaneously, k is the token size in bytes
Each time the application wants to pass a data unit of size N to the network, it
will have to remove at least N/k tokens from the bucket
Implements a relatively constant rate while allowing sporadic bursts
J.P. Carvalho
71
J.P. Carvalho
72
Synchronization Mechanisms
Monitor programs that check streams at relevant instants and adjust rate
if necessary
Multimedia middleware systems offer a collection of interfaces to control
and synchronize streams
J.P. Carvalho
73
Bibliography
1. Tannenbaum, A., Steen, M., Distributed Systems: Principles and Paradigms,
Prentice-Hall International, 2002, Chapter 2.
2. Tannenbaum, A., Computer Networks, Prentice-Hall International, 3rd ed.,
1996.
3. Birrell, A. and Nelson, B., Implementing RPCs, ACM Transactions on
Computer Systems, Vol. 2, No. 1, Pages 39-59, February 1984
4. Bershad, B., Anderson, T., Lazowska, E., and Levy, H., Lightweight Remote
Procedure Call, Proceedings of the 12th ACM Symposium on Operating
Systems Principles, Operating Systems Review, Vol. 23, No. 5, Pages 12-113,
December 1989
5. Sun RPC documentation
http://www.ocaml-programming.de/packages/documentation/rpc/
http://www.cc.gatech.edu/classes/cs4431_99_winter/rpc.html
http://www.pk.org/rutgers/notes/buzz/l-04.html
6. Java RMI documentation
http://java.sun.com/products/jdk/rmi/reference/docs/index.html
http://java.sun.com/j2se/1.3/docs/guide/rmi/
http://tns-www.lcs.mit.edu/manuals/java-api-1.1beta2/guide/rmi/
J.P. Carvalho
74