Distributed Computing
Distributed Computing
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
OSI 7-layered Model Message Encapsulation
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Data Link Layer Network Layer
Prescribe the transmission of a series of bits into a Describes how packets in a network of
frame (packet) to allow for error and flow control. computers are to be routed
Grouping bits into frames and make sure each frame is
It may take several hops from a sender to a
correctly received
receiver
By putting a special bit pattern on the start (header) and
end of each frame (checksum) Routing is the primary task of this layer
Computing checksum The most popular protocol: IP (Internet Protocol)
Examples ATM virtual channel is another example
Ethernet, IEEE 802.11 WLAN
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Client-Server TCP Higher-Level Protocols
Session layer: an enhanced version of transport layer
Provide dialog control
Keep track of which party is currently talking
Provide synchronization facilities
Presentation layer: different machine have different
data representation, thus we need
Conversion, compression, or encryption
Application layer
FTP
HTTP……
Normal TCP Transactional TCP
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Middleware Protocols Chapter 2.2: Remote Procedure Call
Basic RPC operations
Parameter Passing
DCE RPC
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Basic RPC Operations (Cont.) Client and Server Stubs
Problem The main challenge of RPC is to look as
Call-by-value or call-by-reference much like LPC, i.e., transparency
fd, and nbytes are call-by-value
Their value is copied into the stack
Modification in the called procedure but no changes in the Transparency is achieved via “stubs”
calling procedure
buf is call-by-reference A library in the client (client stub) and server
Its address is copied into the stack (server stub)
Modification in the called procedure is reflected in the
calling procedure
To be linked with the program
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Server stub
Be blocked waiting for incoming message by calling receive()
Unpacks the parameters
Calls the corresponding procedure in the usual way (Fig. 2.6)
Returns results to the caller
Does a call to receive again to wait for next request
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
RPC Steps Parameter Passing
1. Client procedure calls client stub in normal way Packing parameters into a message is called parameter
2. Client stub builds message, calls local OS marshaling
3. Client's OS sends message to remote OS It’s fine if
4. Remote OS gives message to server stub Client and server machine are identical
And all the parameters and results are scalar types, like
5. Server stub unpacks parameters, calls server integers, characters, and booleans.
6. Server does work, returns result to the stub However, possible problems:
7. Server stub packs it in message, calls local OS IBM mainframes use EBCDIC char code and IBM PC uses
8. Server's OS sends message to client's OS ASCII code
Integer: one’s complement and 2’s complement
9. Client's OS gives message to client stub
Floating-point numbers
10. Stub unpacks result, returns to client Little endian and big endian
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Extended RPC Models Doors
Doors
RPC for processes located on the same machine OS upcalls the procedure
In some OS, it is called lightweight RPC
(4)
Asynchronous RPC
Clients immediately continues after issuing a RPC request, i.e.,
without blocking
(1)
Deferred synchronous RPC
A client and server interacting through two asynchronous RPCs
Server will call the client when the processing is done (2) Associate the fd with a name
(3)
One-way RPCs
Client continue immediately after calling the server
Do not wait for an acknowledgement from the server
Reliability ? (5)
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Example: DCE RPC Example: DCE RPC (Cont.)
DCE: DistriDuted DoDputiDDDDDiroDDeDt A number of services included
developed by OSF (now called Open Group) Distributed file service
A true middleware system
Support for UNIX, VMS, Windows NT Directory service
Idea: Keep track of the location of all resources
Add DCE on top of existing machines to behave as an distributed
system (p. 61 in Chap. 1)
Programming model: client-server model Security service
All communication between client and server is by RPC
Since RPC system hide the details, client and server are independent Distributed time service
Client in Java and Server in C Keep clocks on different machines globally synchronized
Client and server can run on different hardware or different OS
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
DCE RPC Coding Sequence (Cont.) Binding Client to Server in DCE RPC
Step2: edit the IDL file to fill in names and parameters of RPCs How does the client locate the server?
Step3: compilation and the output has three files
A header file
The unique identifier, type definition, constant definition, and function
prototype Binding
Included in both client and server code
The client stub A process of determining the remote procedure
Contain the actual procedure that the client program will call and the machine on which it executes
The server stub
Contain the procedure called by the runtime system on the server machine
Step 4: write the client and server code and compiler them
Step 5: link the client code, client stub with runtime library. So
as server
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Chapter 2.3: Remote Object Invocation Objects
Distributed Objects Object hides its internals from outside world
Binding a Client to an Object through a well-defined interface
Allow object to be easily modified, as long as the
Static/Dynamic RMI interface remains the same
Parameter Passing Object includes
DCE Remote Objects State: consists of values of its instance variables,
i.e., encapsulate the data
Java RMI
Methods: operations on those data.
Methods are made available through interface
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Distributed Objects Distributed Objects (Cont.)
When a client binds to a distributed object
A proxy must be in the client’s address space
Proxy: client-side stub
Skeleton: server-side stub
Remote object: one kind of distributed objects
State of an object is not distributed
It resides at a single machine
Only interfaces are made available
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Implicit & Explicit Binding Implicit & Explicit Binding
Implicit binding
Distr_object* obj_ref; //Declare a systemwide object reference
Allows a client to directly invoke methods using obj_ref = …; // Initialize the reference to a distributed object
obj_ref-> do_something(); // Implicitly bind and invoke a method
only a reference to an object
(a)
Explicit binding
Distr_object objPref; //Declare a systemwide object reference
The client should call a special function to bind to Local_object* obj_ptr; //Declare a pointer to local objects
obj_ref = …; //Initialize the reference to a distributed object
the object before it actually invoke its methods obj_ptr = bind(obj_ref); //Explicitly bind and obtain a pointer to the local proxy
obj_ptr -> do_something(); //Invoke a method on the local proxy
(b)
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Implementation of Object Reference Static and Dynamic Remote Method
(Cont.) Invocations
Problem (Cont.) RMI (Remote Method Invocation)
Protocol assumption client and server must use Invoke an object’s method through proxy
the same protocol stack Static invocation
Sol: include implementation handle in the object Use predefined interface definitions
reference Either use interface definition language like RPC approach
e.g. [Link] Or use object-based language (Java) that generate stub
From implementation handle, client can dynamically automatically.
downloaded the needed proxy A change to the interface requires all applications (i.e.
Client need not worry about whether it has an clients) to be recompiled
implementation of a specific protocol available
[Link](para)
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Parameter Passing Example 1: DCE Remote Objects
Client program at A invoke method of object running at C.
Two object references to O1 and O2 are passed along as parameters DCE’s RPC mechanism has been “enhanced” to
But reference to O1 is a local object while to O2 is remote directly support remote method invocation
An extension to their RPC model that is refined from RPC
DCE Objects = xIDL plus C++.
Distributed object are specified in IDL and implemented
in C++
So that object at
C can access O1 DEC distributed objects take the form of remote
directly=>
efficient
objects
A server is responsible for creating C++ objects locally
and making methods available to remote client
There is no way to create distributed objects
The situation when passing an object by reference or by value.
Note: O1 is passed by value; O2 is passed by reference.
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Example 1: DCE Remote Objects
The DCE Distributed-Object Model
(Cont.)
Problem in DCE objects
No mechanism for transparent object reference
Since refine from RPC, each object invocation is done by RPC
Thus, lacking a proper system-wide object reference mechanism
Transparency: client only identifies a remote procedure
in a server
But in DCE, client identifies a remote procedure in a server’s
object
Pass the object identifier, the interface identifier, and parameters
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Java Distributed-Object Model (Cont.) Java Remote Object Invocation
Semantics of blocking on an local or remote object Any primitive or object type can be passed as
Java supports objects to be as monitor
By declaring a method to be synchronized a para to an RMI only if it can be marshaled
Only one process can proceed if two processes call a
synchronized method Which is called serializable in Java terminology
The other process is blocked inside a (local) object waiting for a Platform dependent object, like file descriptors
conditional variables
But how to blocking on remote object if invoking a and sockets, cannot be serialized
remote synchronized method
Sol 1: allowing blocking only at server Like DCE, local objects are passed by value
What happened when a client crashes when its invocation is being
handled by the server?
and remote objects are passed by reference
Sol 2: blocking at proxy, i.e., client-side stub
Need to synchronize different clients at different machine (complex)
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Java Remote Object Invocation (Cont.) Java Remote Object Invocation (Cont.)
Proxy itself is serializable (proxy just likes local obj.) A remote object is built from two classes
Can be marshaled, sent, then unmarshaled remotely and Server class: implementation of server-side code
used to invoke method on the another remote object Contain the object’s state and method
A proxy can be used as a reference to a remote object Skeleton: server-side stub, is generated from the interface
i.e., Allow remote invocation at any machine specifications of the object
Distinguishing features of Java RMI Client class: implementation of a proxy
This is possible only when each process is executed the same Java Also generated from the object’s interface spec.
virtual machine, i.e., the same execution environment Convert each method call into a message and a reply message
DCE does not allow stub passing into the result of a method call
DCE allows difference processes at difference languages, operating For each call, proxy also sets up a connection with a server
system and hardware platform Thus, it has all the information to let client finds remote object
Server’s network address, endpoint, identifier of the object
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Chapter 2.4 Message-Oriented
Communication Introduction
Persistence and Synchronicity As a communications mechanism, RPC/RMI is often
inappropriate.
The receiving side must be executing at the time a request
is made.
Message-Oriented Transient Communication The inherent synchronous mode of their operation forces
the client to be blocked
However,
Message-Oriented Persistent Communication What happens if the receiving side is not “awake”?
In addition, the default “synchronous, blocking” nature of
RPC/RMI is often too restrictive.
IBM MQSeries Something else is needed: Messaging
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Persistence and Synchronicity: Six
Persistence and Synchronicity (Cont.) Cases
Synchronous Communications Persistence and Synchronicity lead to six
combinations
A sender DDDcDs, DaiDiDDfor a reply from the
(a) Persistent asynchronous communication
receiver before doing any other work
Msgs are stored at the local host or at the communication
server, ex., email
Asynchronous Communications (b) Persistent synchronous communication
Msgs are presistently stored only at the receiving host
A sender cDDDiDDes with other work immediately Sender is blocked until its message is stored in receiver’s
upon sending a message to the receiver buffer
Not necessary the receiving application is executing to store the
message
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Persistence and Synchronicity: Six
Classifying Distributed Communications (2) Cases (Cont.)
(e) Delivery-based transient synchronous
communication
The sender is blocked until the message is delivered to the
receiver for further processing
Asynchronous RPC follows this policy
(f) Response-based transient synchronous
communication
The strongest form of synchronous behavior
The sender is blocked until it receives a reply from the
other side
RPC and RMI adhere to this
c) Transient asynchronous communication.
d) Receipt-based transient synchronous communication.
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Message-Oriented DraDsieDD
Classifying Distributed Communications (3) Communications
Transient Messaging Examples
Sockets
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Some MPI Primitives MPI Primitives
Primitive Meaning MPI_bsend =
MPI_bsend Append outgoing message to a local send buffer Transient asynchronous comm
MPI_send Send a message and wait until copied to local or remote buffer MPI_send, the semantics depends on implmentation
MPI_ssend Send a message and wait until receipt starts MPI_senduntil copies to local buffer =
Receipt-based transient synch comm
MPI_sendrecv Send a message and wait for reply
MPI_send until copies to remote buffer =
MPI_isend Pass reference to outgoing message, and continue Delivery-based transient synch comm
MPI_issend Pass reference to outgoing message, and wait until receipt starts MPI_ssend =
MPI_recv Receive a message; block if there are none Delivery-based transient synch comm
MPI_irecv Check if there is an incoming message, but do not block MPI_sendrecv =
Response-based transient synch comm
Some of the more intuitive (and useful) message-passing primitives
(Note: there are many more in the API).
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Message-Oriented Persistent
Communication Message-Queuing Models
It offers intermediate-term storage capacity for messages
Also known as: Message Queuing Systems, Without requiring either the sender or receiver active during message
or Message Oriented Middleware (MOM) transmission
Apps communicate by inserting messages into specific queues
Support persistent, asynchronous comms Forwarded to destination, even if dest. down when message was sent.
Addressing by a system-wide unique name of the destination
Basic idea: processes communicate through
queue
support of middleware queues. Only guarantee: your message will eventually make it into the
Queues are buffers at communication servers. receiver’s message queue
No guarantee about when, or even if the message will be actually read
Key Example: IBM MQSeries Typically, transport can take minutes as opposed to
seconds/milliseconds in Sockets or MPI
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Message Queuing Interface Message-Queuing Models System is storing (and possibly transmitting)
message while sender and receiver are passive
Primitive Meaning
Put Append a message to a specified queue (nonblocking)
Block until the specified queue is nonempty, and remove
Get
the first message (blocking)
Check a specified queue for messages, and remove the
Poll
first. Never block. (nonblocking)
Install a handler in receiver to be called when a message
Notify
is put into the specified queue. (callback function)
Basic interface to a queue in a message-queuing system: this is a very Four combinations for “loosely-coupled” communications which use
simple, yet extremely powerful abstraction. message-queues.
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
General Architecture of a Message-Queuing General Architecture of a Message-Queuing
System (1) System (2)
The relationship between queue-level addressing and network-level The general organization of a message-queuing system with routers
addressing. (relays).
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Message Brokers (Cont.) A Note on Message-Queuing System
But the message format must be understood by Message-queuing is different from email system
both sender and receiver Email is targeted for end users
MQ is a general-purpose interprocess comm and holds lots
By the “Message Broker”. features
Message broker: act as an application gateway Message priorities, logging facilities, efficient multicasting, fault-
tolerance
to convert incoming messages to a format
D oDDDmDorDDDDD
D D DDDlDDDDD
oDDreDD
understood by the receiver The integration of a widely dispersed collection of DDDDbDDe
By a database of rules DDDlDDDDDoDD(which is impossible to do with traditional
RPC/RMI techniques).
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
IBM MQSeries: Message Channels Message Transfer in MQSeries
An address consists of (name of QM, name of Destination
Attribute Description
Queue)
Transport type Determines the transport protocol to be used. A QM may consists of many queues
FIFO delivery Indicates that messages are to be delivered in the order they are sent. Routing table entry in QM = (destQM, next_sendQ)
Message length Maximum length of a single message. QM’s name is systemwide unique
Setup retry
Specifies maximum number of retries to start up the remote MCA. However, when replace a QM or change a QM’s name affects all apps
count that send messages to this QM
Delivery retries Maximum times MCA will try to put received message into queue. Solution: local alias: a logical name of a QU
By local alias
Some attributes associated with message channel agents Change the name of a QM requires change its alias in all queue
(MCA). managers
But the applications can be left unaffected
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Chapter 2.5: Stream-Oriented
Communications Stream-Oriented Communications
Continuous Media Support With RPC, RMI and MOM, timing has no effect on
correctness.
However, audio and video are time-dependent data streams
If the timing is off, the resulting “output” from the system will be
Quality of Service (QoS) incorrect.
Time-dependent information – known as “continuous media”
communications.
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Virtual Connections Multicasting Stream
A stream can be considered as a virtual connection between a source and a sink
Definition: “ensuring that the temporal relationships maximum data unit size (bytes) Loss sensitivity (bytes)
in the stream can be preserved”. Token bucket rate (bytes/sec) Loss interval (sec)
QoS is all about three things: Toke bucket size (bytes) Burst loss sensitivity (data units)
Maximum transmission rate Minimum delay noticed (sec)
(a) Timeliness, (b) Volume and (c) Reliability (bytes/sec) Maximum delay variation (sec)
But, how is QoS actually specified? Quality of guarantee
One approach: expressing QoS by flow specification
Specify bandwidth requirements, transmission rates, delays..
Ref. the next slide A flow specification – one way of specifying QoS
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
An Approach to Implementing QoS:
Token Bucket Algorithm Token Bucket Algorithm
In flow spec. the characteristics of the input stream are
formulated by Token bucket algorithm
Specify how the stream will shape its network traffic
Token: a fixed number of bytes that an app is allowed
to pass to network
Tokens are buffered in a bucket with limited capacity
Tokens are dropped when bucket is full,
Data are passed to network at a relatively constant rate
The principle of a token bucket algorithm – a “classic” technique for
controlling the flow of data (and implementing QoS characteristics).
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Setting up of a Stream RSVP
After flow specification, DS should allocate resource Resource reSerVation Protocol (RSVP)
A transport-level protocol for enabling resources reservation in
to set up a stream, including network routers
Bandwidth, buffers, and processing capacity First, senders in RSVP
Set up a path to receivers.
Which are all needed in order to realize QoS guarantees Then provide a flow specification and send it to each intermediate node
However, it is not easy that a model can RSVP is a receiver-initiated protocol
Receiver, when ready to receive, places a reservation request along
Specify a QoS parameters its upstream path to sender
Generically describe resources in any communication Reservation can be lower than sender’s specification
system RSVP process reserves resources if enough
By admission control module
Translate QoS parameters to resource usage RSVP process will translate QoS parameters into things that make
sense to the data-link layer
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]
Stream Synchronization (Cont.) Receive-Side with Application-Aware
Synchronization mechanism
Where does the synchronization occur?
On the sending side or receiving side?
Application transparency?
Application take care by itself or by middleware
The principle of explicit synchronization on the level data units for multiple streams
(sub-streams).
PDF created with FinePrint pdfFactory Pro trial version [Link] PDF created with FinePrint pdfFactory Pro trial version [Link]