0% found this document useful (0 votes)
35 views76 pages

DC Module 2b

The document discusses layered protocols and remote procedure calls. It describes the OSI model and its layers. It then covers remote procedure calls, including how they allow calling procedures on remote systems, and how parameter passing and asynchronous and synchronous calls work. The document also discusses remote object invocation using technologies like Java RMI.
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)
35 views76 pages

DC Module 2b

The document discusses layered protocols and remote procedure calls. It describes the OSI model and its layers. It then covers remote procedure calls, including how they allow calling procedures on remote systems, and how parameter passing and asynchronous and synchronous calls work. The document also discusses remote object invocation using technologies like Java RMI.
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/ 76

Communication

Chapter 2
Agenda
⚫ 2.1 Layered protocols
⚫ 2.2 Remote Procedure
⚫ 2.3 Remote Object Invocation
⚫ 2.4 Message-Oriented Communication
⚫ 2.5 Stream-Oriented Communication
2.1 Layered Protocols

Shu Lei([email protected])
1 - Layered Protocols
⚫ OSI: Open Systems Interconnection
⚫ Developed by the International Organization for Standardization (ISO)
⚫ Provides a generic framework to discuss the layers and functionalities of
communication protocols.

Layers, interfaces, and protocols in the OSI model.


OSI Model (con.t)

A typical message as it appears on the network.


OSI Protocol Layers
⚫ Physical layer
⚫ Deals with the transmission of bits
⚫ Physical interface between data transmission device
⚫ (e.g. computer) and transmission medium or network
⚫ Concerned with:
⚫ Characteristics of transmission medium, Signal levels, Data rates

⚫ Data link layer:


⚫ Deals with detecting and correcting bit transmission
errors
⚫ Bits are group into frames
⚫ Checksums are used for integrity

Real-Time & MultiMedia Lab


OSI Protocol Layers (con.t)
⚫ Discussion between a receiver and a sender in the data
link layer.
OSI Protocol Layers (con.t)
⚫ Network layer:
⚫ Performs multi-hop routing across multiple networks
⚫ Implemented in end systems and routers

⚫ Transport layer:
⚫ Packing of data
⚫ Reliable delivery of data (breaks message into pieces small
enough, assign each one a sequence number and then send
them)
⚫ Ordering of delivery
⚫ Examples:
⚫ TCP (connection-oriented)
⚫ UDP (connectionless)
⚫ RTP (Real-time Transport Protocol)
Real-Time & MultiMedia Lab
OSI Protocol Layers (con.t)
Client-Server TCP protocol

(a) Normal operation of TCP. (b) Transactional TCP.

Real-Time & MultiMedia Lab


OSI Protocol Layers (con.t)
⚫ Session layer
⚫ Provide dialog control to keep track of which party is
talking and it provides synchronization facilities

⚫ Presentation layer
⚫ Deals with non-uniform data representation and with
compression and encryption

⚫ Application layer
⚫ Support for user applications
⚫ e.g. HTTP, SMPT, FTP

Real-Time & MultiMedia Lab


Middleware Protocols
⚫ Support high-level communication services
⚫ The session and presentation layers are merged into the middleware layer,
⚫ Ex: Microsoft ODBC (Open Database Connectivity), OLE DB…

An adapted reference model for networked communication.


Real-Time & MultiMedia Lab
Types of communication
Ways of communication
⚫ Persistent
⚫ Transient
⚫ Asynchronous
⚫ Synchronous
2.2 Remote Procedure Call
Remote Procedure call
⚫ Basic idea: To execute a procedure at a remote site and
ship the results back.
⚫ Goal: To make this operation as distribution transparent
as possible (i.e., the remote procedure call should look like
a local one to the calling procedure).

Example:
read(fd, buf, nbytes)
Client and Server Stubs
Definition: Are additional functions which are added to
the main functions in order to support for RPC
Client Server

count = doSomething(); procedure doSomething();

Client Stub Server Stub

OS OS

Real-Time & MultiMedia Lab


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

Real-Time & MultiMedia Lab


Passing Value Parameters (1)

Steps involved in doing remote computation through RPC

Real-Time & MultiMedia Lab


Passing Value Parameters (2)
⚫ In a large distributed system, multiple machine types are
present
⚫ Each machine has its own representation for number,
characters, and others data items.

a) Original message on the Pentium (little-endian)


b) The message after receipt on the SPARC (big-endian )
c) The message after being inverted. The little numbers in boxes indicate the address of
each byte

Real-Time & MultiMedia Lab


Parameter Specification
⚫ Caller and callee agree on the format of message they
exchange
Ex: word = 4 bytes
float = 1 word
character is the rightmost byte of word
=> the client stub must use this format and the server stub know that incoming
message for foobar has this format

Real-Time & MultiMedia Lab


Asynchronous RPC (1)
⚫ Avoids blocking of the client process.
⚫ Allows the client to proceed without getting the final
result of the call.

a) The interconnection between client and server in a traditional RPC


b) The interaction using asynchronous RPC

Real-Time & MultiMedia Lab


Differed synchronous
One-way RPC model: client does not wait for an
acknowledgement of the server’s acceptance of the
request.

A client and server interacting through two asynchronous RPCs

Real-Time & MultiMedia Lab


Example DCE RPC
⚫ What is DCE ? (Distributed Computing Environment)
⚫ DCE is a true middleware system in that it is designed to
execute as a layer of abstraction between exiting (network)
operating system and distributed application.

⚫ -Goals of DCE RPC


⚫ Makes it possible for client to access a remote service by
simply calling a local procedure.

⚫ Components:
⚫ Languages
⚫ Libraries
⚫ Daemon
⚫ Utility programs
⚫ Others

Real-Time & MultiMedia Lab


Writing a Client and a Server
Generate a prototype IDL file
containing an interface identify

Filling in the names of remote procedure


and their parameters
IDL compiler is call to
compile into three files
2-14

The steps in writing a client and a server in DCE RPC.


Real-Time & MultiMedia Lab
Binding a Client to a Server

Endpoint (port) is used by server’s


OS to distinguish incoming message

Client-to-server binding in DCE.


Real-Time & MultiMedia Lab
2.3 Remote Object Invocation
Objectives
⚫ RMI vs RPC
⚫ Remote Distributed Objects
⚫ Binding a client to object
⚫ Parameter Passing
⚫ Java RMI
⚫ Example
⚫ Summary
RMI vs RPC
⚫ The primary difference between RMI and RPC:

⚫ PRC is used for procedure – based application.


⚫ RMI is used for distributed object systems.
⚫ RMI is object oriented.
⚫ PRC is procedural.
Remote Distributed Objects(1)
⚫ Objects separate their actual implementation from their
interface
⚫ Distributed object = an object which publishes its
interface on other machines
⚫ Remote object = a distributed object whose state is
encapsulated (their state is not distributed)
2-16

⚫ Common organization of a remote object with client-side proxy.


Compile-time vs Runtime

⚫ Java ,C++ compile time object invocation


⚫ In java interfaces are used compile time
⚫ Drawback is dependency on particular programming
language

⚫ Run time how objects are implemented it’s left open


⚫ Object adapter
Persistent and Transient objects
⚫ Persistent – executes even if not containing in servers
address space .
⚫ Not dependent on server

⚫ Transient exists only as long as server manages


Binding a Client to an Object (1)
• Two ways of binding:
- Implicit: Invoke methods directly on the referenced object
- Explicit: Client must first explicitly bind to object before
invoking it
Binding a Client to an Object (2)

Distr_object* obj_ref; //Declare a systemwide object reference


obj_ref = …; // Initialize the reference to a distributed object
obj_ref-> do_something(); // Implicitly bind and invoke a method
(a)
Distr_object objPref; //Declare a systemwide object reference
Local_object* obj_ptr; //Declare a pointer to local objects
obj_ref = …; //Initialize the reference to a distributed object
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)

a) An example with implicit binding using only global references


b) An example with explicit binding using global and local references
Static Vs Dynamic Remote Method Invocation

⚫ Once client bound to the object it invoke object method


through
the proxy is called RMI. Java is used.

⚫ Static Invocation : uses predefine interface definitions.


Interface of an object are know when client application is
being developed. If interface changes client application
must be recompiled.

⚫ Dynamic Invocation : application selects at runtime which


method it will invoke.

fobject.append(int)
invok(fobject,id(append),int)
Parameter Passing (1)
⚫ Pass remote object by reference

⚫ Pass local object by value

⚫ Local object = an object in the client’s


address space

Real-Time & MultiMedia Lab


Parameter Passing (2)
⚫ The situation when passing an object by reference or by value.

2-18

Real-Time & MultiMedia Lab


Java RMI (1)
⚫ Distributed objects integrated into the Language
⚫ Goal is to achieve transparency!
⚫ Any serializable object type can be a parameter to an
RMI
⚫ Local objects are passed by value, remote objects are
passed by reference
⚫ Proxy can be used as a reference to a remote object:
Possible to serialize the proxy and send it to another
server
Java RMI (2)
Example
⚫ Integral Calculation with the following function:
+ Sin(x) (0 ÷ Pi)
+ Cos(x) (Pi/2 ÷ Pi)
+ X^2(0 ÷ 5)
Approximate with 10, 100, 1000 steps.
⚫ The integral is calculated according to the
midpoint rule.
Example
Client Server
RemoteIntegral RemoteIntegralI
Client mpl
2
1
4
3

RemoteIntegral rmiregistry
6

RemoteIntegralImpl_Ske
RemoteIntegralImpl_Stub
l

Real-Time & MultiMedia Lab


Summary
⚫ RMI specific for a remote object
⚫ Remote object offer better transparence
⚫ RMIs allow object references to be passes as
parameter
⚫ Local objects are passed by value
⚫ Remote objects are passed by reference

Real-Time & MultiMedia Lab


2.4 Message-Oriented Communication
Manhyung Han([email protected])

Real-Time & MultiMedia Lab


Introduction
⚫ Message-Oriented Communication

⚫ RPC and RMI enhanced access transparency


⚫ But client have to blocked until its request has been
processed
⚫ Message-Oriented Communication can solve this
problem by ‘messaging’
⚫ Index:
⚫ Meaning of synchronous behavior and its implication
⚫ Various messaging systems
⚫ Message-queuing system

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(1)
⚫ General communication system connected through a
network
⚫ Each host is connected to a single communication server.
⚫ Hosts and communication servers can have buffers.

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(2)
⚫ Persistent communication

⚫ An example of persistent communication – Letter back in


the days of Pony Express

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(3)
⚫ Persistent vs. Transient

⚫ Persistent messages are stored as long as necessary by the


communication system (e.g., e-mail)
⚫ Transient messages are discarded when they cannot be
delivered (e.g., TCP/IP)

⚫ Synchronous vs. Asynchronous

⚫ Asynchronous implies sender proceeds as soon as it sends the


message no blocking
⚫ Synchronous implies sender blocks till the receiving host
buffers the message

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(4)
⚫ Persistent asynchronous/synchronous communication

(a) Persistent asynchronous communication / (b) Persistent synchronous communication

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(5)
⚫ Transient asynchronous/Receipt-based transient
synchronous communication

(c) Transient asynchronous communication / (d) receipt-based transient synchronous communication

Real-Time & MultiMedia Lab


Persistence and Synchronicity in Communication(6)
⚫ Other transient synchronous communications

(e) Delivery-based transient synchronous communication at message delivery


(f) Response-based transient synchronous communication

Real-Time & MultiMedia Lab


Message-Orient Transient Communication(1)
⚫ Message-Oriented Model

⚫ Many distributed systems and applications are built on


top of the simple message-oriented model
⚫ These models are offered by Transport Layer
⚫ Message-oriented models
⚫ Berkeley Sockets: Socket interface as introduced in Berkeley
UNIX
⚫ The Message-Passing Interface(MPI): designed for parallel
applications and as such in tailored to transient communication

Real-Time & MultiMedia Lab


Message-Orient Transient Communication(2)
⚫ Berkeley Sockets(1)

⚫ Meaning of Socket: a communication endpoint to which


an application can write data (be sent to network) and
read incoming data .The socket primitives for TCP/IP
Primitive Meaning
Socket Create a new communication endpoint

Bind Attach a local address to a socket

Listen Announce willingness to accept connections

Accept Block caller until a connection request arrives

Connect Actively attempt to establish a connection

Send Send some data over the connection

Receive Receive some data over the connection


Real-Time & MultiMedia Lab
Close Release the connection
Message-Orient Transient Communication(3)
⚫ Berkeley Sockets(2)
⚫ Connection-oriented communication pattern using
sockets
⚫ Sockets considered insufficient because:
⚫ Support only send and receive primitives
⚫ Designed for communication using general-purpose protocol such
Create a new Associate Waiting Block waiting for
endpoint
as endpoint
TCP/IP connection reqs

Real-Time & MultiMedia Lab


Message-Orient Transient Communication(4)
⚫ The Message-Passing Interface(MPI)(1)

⚫ Designed for multiprocessor machines and


high-performance parallel programming
⚫ Provides a high-level of abstraction than sockets
⚫ Support diverse forms of buffering and synchronization
(over 100 functions)

Real-Time & MultiMedia Lab


Message-Orient Transient Communication(5)
⚫ The Message-Passing Interface(MPI)(2)

⚫ Some of
Primitive the most
Meaning intuitive message-passing primitives of
MPI_bsend MPI Append outgoing message to a local send buffer

MPI_send Send a message and wait until copied to local or remote buffer

MPI_ssend Send a message and wait until receipt starts

MPI_sendrecv Send a message and wait for reply

MPI_isend Pass reference to outgoing message, and continue

MPI_issend Pass reference to outgoing message, and wait until receipt starts

MPI_recv Receive a message; block if there are none

MPI_irecv Check if there is an incoming message, but do not block

Real-Time & MultiMedia Lab


Message-Orient Persistent Communication(1)
⚫ Message-Queuing Model(1)

⚫ Apps communicate by inserting messages in specific


queues
⚫ Loosely-couple communication
⚫ Support for:
⚫ Persistent asynchronous communication
⚫ Longer message transfers(e.g., e-mail systems)
⚫ BasicMeaning
Primitive interface to a queue in a message-queuing system:
Put Append a message to a specified queue

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
Install a handler to be called when a message is put into the specified
Notify
Real-Time & MultiMedia
queue Lab
Message-Orient Persistent Communication(2)
⚫ Message-Queuing Model(2)
⚫ ‘

⚫ Four combinations for loosely-coupled communication


using queues:

Real-Time & MultiMedia Lab


Message-Orient Persistent Communication(3)
⚫ General architecture of a Message-Queuing System(1)

⚫ Messages can only be put and received from local queues


⚫ Ensure transmitting the messages between the source queues and
destination queues, meanwhile storing the messages as long as
necessary
⚫ Each queue is maintained by a queue manager

The relationship between queue-level addressing and network-level addressing


Real-Time & MultiMedia Lab
Message-Orient Persistent Communication(4)
⚫ General architecture of a Message-Queuing System(2)
⚫ Queue managers are not only responsible for directly interacting
with applications but are also responsible for acting as relays (or
routers)

Queue managers form an overlay network, acting as routers


Real-Time & MultiMedia Lab
Message-Orient Persistent Communication(5)
⚫ General–purpose of a Message-Queuing System

⚫ Enable persistent communication between processes


⚫ Handling access to database
⚫ In wide range of application, include:
⚫ Email
⚫ Groupware
⚫ Batch processing

Real-Time & MultiMedia Lab


Message-Orient Persistent Communication(6)
⚫ Message Broker

The general organization of a message broker in a message-queuing system

Real-Time & MultiMedia Lab


Summary & Conclusion
⚫ Summary
⚫ Two different communication concept ‘Transient vs.
Persistent’
⚫ Persistent messages are stored as long as necessary
⚫ Transient messages are discarded when they cannot be delivered
⚫ Message-Oriented Transient Comm.
⚫ Berkeley socket and MPI
⚫ Message-Oriented Persistent Comm.
⚫ Message-Queuing Model and Message Broker

⚫ Conclusion
⚫ Message-Oriented communication solve the blocking
problems that may occur in general communication between
Server/Client
⚫ Message-Queuing systems can users(including applications)
to do Persistent communication
Real-Time & MultiMedia Lab
2.5 Stream-Oriented Communication
Manhyung Han([email protected])

Real-Time & MultiMedia Lab


Support for Continuous Media(1)
⚫ Types of media

⚫ Continuous media
⚫ Temporal dependence between data items
⚫ ex) Motion - series of images

⚫ Discrete media
⚫ No temporal dependence between data items
⚫ ex) text, still images, object code or executable files

Real-Time & MultiMedia Lab


Support for Continuous Media(2)
⚫ Data Stream

⚫ Sequence of data units


⚫ Discrete data stream: UNIX pipes or TCP/IP connection
⚫ Continuous data stream: audio file (connection between file
and audio devices)

⚫ Transmission modes

⚫ Asynchronous: no timing constraints


⚫ Synchronous: upper bound on propagation delay
⚫ Isochronous: upper and lower bounds on propagation delay
(transfer on time)

Real-Time & MultiMedia Lab


Support for Continuous Media(3)
⚫ Types of stream

⚫ Simple stream
⚫ consist of only a single sequence of data
⚫ Complex stream
⚫ consist of several related simple stream
⚫ ex) stereo audio, movie
⚫ Substream
⚫ related simple stream
⚫ ex) stereo audio channel

Real-Time & MultiMedia Lab


Support for Continuous Media(4)
Figure. 2-35
(a) Setting up a stream
between two
processes across a
network
(b) Setting up a stream
directly between
two devices

Real-Time & MultiMedia Lab


Support for Continuous Media(5)
Figure. 2-36
An example of multicasting a stream to
several receivers

Real-Time & MultiMedia Lab


Streams and Quality of Service(1)
⚫ Specifying QoS(1)

⚫ Flow specification
⚫ To provide a precise factors(bandwith, transmission rates
and delay, etc.)
⚫ Example of flow specification developed by Partridge
Figure. 2-37 A flow specification
Characteristics of the Input Service Required
Loss sensitivity (bytes)
Maximum data unit size (bytes) Loss interval (microsec)
Token bucket rate (bytes/sec) Burst loss sensitivity (data units)
Token bucket size (bytes) Minimum delay noticed (microsec)
Maximum transmission rate (bytes/sec) Maximum delay variation (microsec)
Quality of guarantee

Real-Time & MultiMedia Lab


Streams and Quality of Service(2)
⚫ Specifying QoS(2)

⚫ Token bucket algorithms


⚫ Tokens are generated at a constant rate
⚫ Token is fixed number of bytes that an application is allowed to
Figure. 2-38 pass to the network
The Principle of a
token bucket
algorithm

Real-Time & MultiMedia Lab


Streams and Quality of Service(3)
⚫ Setting up a stream

⚫ Resource reSerVation Protocol(RSVP)


⚫ Transport-level control protocol for enabling resource reservation
in network router
⚫ Used to provide QoS for continuous data streams by reserving
resources (bandwidth, delay, jitter and so on)
⚫ Issue: How to translate QoS parameters to resource usage?
⚫ Two ways to translate
1. RSVP translates QoS parameters into data link layer
parameters
2. Data link layer provides its own set of parameters (as in
ATM)
Real-Time & MultiMedia Lab
Streams and Quality
Figure. 2-39of Service(4)
The basic organization of RSVP for resource
reservation in a distributed system

Real-Time & MultiMedia Lab


Streams and Quality of Service(5)

Real-Time & MultiMedia Lab


Streams and Quality of Service(6)

Real-Time & MultiMedia Lab


Stream Synchronization(1)
⚫ Basic ideas

⚫ Synchronize transmission of data units


⚫ Synchronization take place when the data stream is made
up
⚫ Stereo audio with CD quality(16 bit samples)
⚫ Sampling rate 44.1 KHz -> synchronize 22.6 micro sec
⚫ Synchronization between audio stream and video stream
for lip sync.
⚫ NTSC 30Hz(a frame every 33.33ms), CD Quality sound
⚫ Synchronized every 1470 sound samples

Real-Time & MultiMedia Lab


Stream Synchronization(2)
⚫ Synchronization Mechanisms(1)

Figure. 2-40
The principle
of explicit
synchronizatio
n on the level
data units

Real-Time & MultiMedia Lab


Stream Synchronization(3)
⚫ Synchronization Mechanisms(2)

Figure. 2-41
The principle of
synchronization
as supported by
high-level
interfaces

Real-Time & MultiMedia Lab

You might also like