You are on page 1of 67

Communication

Chapter 2

Kyung Hee University

1/63

Agenda
1-Layered protocols 2-Remote Procedure 3-Remote Object Invocation 4-Message-Oriented Communication 5-Stream-Oriented Communication

Kyung Hee University

2/63

1 - Layered Protocols

Kyung Hee University

3/63

OSI Model
-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.

Kyung Hee University

Layers, interfaces, and protocols in the OSI model.


4/63

OSI Model (con.t)

2-2

A typical message as it appears on the network.


Kyung Hee University 5/63

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

Kyung Hee University

6/63

OSI Protocol Layers (con.t)


Discussion between a receiver and a sender in the data link layer.

Kyung Hee University

7/63

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
assign each one a sequence number and then send them)

+Reliable delivery of data (breaks message into pieces small enough, +Ordering of delivery Examples: TCP (connection-oriented) UDP (connectionless) RTP (Real-time Transport Protocol)

Kyung Hee University

8/63

OSI Protocol Layers (con.t)


Client-Server TCP protocol

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


Kyung Hee University 9/63

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

Kyung Hee University

10/63

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.


Kyung Hee University 11/63

2 - Remote Procedure Call

Kyung Hee University

12/63

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)

Kyung Hee University

13/63

Client and Server Stubs


Definition: Are additional functions which are added to the main functions in order to support for RPC

Client
count = doSomething();

Server
procedure doSomething();

Client Stub

Server Stub

OS

OS

Kyung Hee University

14/63

Steps of a Remote Procedure Call


1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Client procedure calls client stub in normal way Client stub builds message, calls local OS Client's OS sends message to remote OS Remote OS gives message to server stub Server stub unpacks parameters, calls server Server does work, returns result to the stub Server stub packs it in message, calls local OS Server's OS sends message to client's OS Client's OS gives message to client stub Stub unpacks result, returns to client
15/63

Kyung Hee University

Passing Value Parameters (1)


2-8

Steps involved in doing remote computation through RPC


Kyung Hee University 16/63

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) b) c)

Original message on the Pentium (little-endian) The message after receipt on the SPARC (big-endian ) The message after being inverted. The little numbers in boxes indicate the address of each byte
17/63

Kyung Hee University

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

Kyung Hee University

18/63

Asynchronous RPC (1)


-Avoids blocking of the client process. -Allows the client to proceed without getting the final result of the call.

2-12

a) b)

The interconnection between client and server in a traditional RPC The interaction using asynchronous RPC
19/63

Kyung Hee University

Deferred Synchronous RPC(2)


One-way RPC model: client does not wait for an acknowledgement of the servers acceptance of the request.

2-13

A client and server interacting through two asynchronous RPCs


Kyung Hee University 20/63

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

Kyung Hee University

21/63

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

Kyung Hee University

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


22/63

Binding a Client to a Server

2-15

Endpoint (port) is used by servers OS to distinguish incoming message

Client-to-server binding in DCE.


Kyung Hee University 23/63

3-Remote Object Invocation

Kyung Hee University

24/63

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 centralized

Kyung Hee University

25/63

Distributed Objects (2)

2-16

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


Kyung Hee University 26/63

Binding a Client to an Object (1)

When a client binds to a distributed object, an implementation of the object interface (proxy) is loaded into the clients address space

Kyung Hee University

27/63

Binding a Client to an Object (2)


Distr_object* obj_ref; obj_ref = ; obj_ref-> do_something(); (a) Distr_object objPref; Local_object* obj_ptr; obj_ref = ; obj_ptr = bind(obj_ref); obj_ptr -> do_something(); (b) //Declare a systemwide object reference //Declare a pointer to local objects //Initialize the reference to a distributed object //Explicitly bind and obtain a pointer to the local proxy //Invoke a method on the local proxy //Declare a systemwide object reference // Initialize the reference to a distributed object // Implicitly bind and invoke a method

a) b)

An example with implicit binding using only global references An example with explicit binding using global and local references Problems: + Language dependent + Address of server an Object reference
Kyung Hee University 28/63

Parameter Passing (2)


Pass remote object by reference Pass local object by value Local object = an object in the clients address space

Kyung Hee University

29/63

Parameter Passing (2)

2-18

The situation when passing an object by reference or by value.


Kyung Hee University

stream

30/63

Example: Java RMI (1)


Java Distributed-Object Model
Distributed objects integrated into the Language Goal is to achieve transparency! (keep as much of semantics of nondistributed objects as possible)

Kyung Hee University

31/63

Java RMI (2)


Local vs. Remote object differences when 1. Cloning:
proxies Cloning the actual object only, and not its

2. Synchronizing
Synchronized methods Only proxy synchronization is allowed only

Kyung Hee University

32/63

Java RMI (3)


Any serializable object type can be a parameter to an RMI
Platform dependent objects (e.g., sockets, file descriptors,etc) are not serializable

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 Kyung Hee University server to another

33/63

Java RMI (4)

Kyung Hee University

stream

34/63

4-Message-Oriented Communication

Kyung Hee University

35/63

Persistence and Synchronicity in Communication


General organization of a communication system in which hosts are connected through a network
+Each host is connected to a single communication server. +Hosts and communication servers can have buffers.

Kyung Hee University

36/63

Persistence and Synchronicity in Communication


Persistent communication of letters back in the days of the Pony Express

Kyung Hee University

37/63

Persistence and Synchronicity in Communication Definition


-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

Kyung Hee University

38/63

Persistence and Synchronicity in Communication

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


Kyung Hee University

39/63

Persistence and Synchronicity in Communication

(c) Transient asynchronous communication (d) Receipt-based transient synchronous communication


Kyung Hee University 40/63

Persistence and Synchronicity in Communication

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

Kyung Hee University

41/63

Message-Orient Transient Communication


u Berkeley Sockets:
u Socket: a communication endpoint to which an application can write data (be sent to network) and read incoming data.
Primitive Socket Bind Listen Accept Connect Send Receive Close Meaning Create a new communication endpoint Attach a local address to a socket Announce willingness to accept connections Block caller until a connection request arrives Actively attempt to establish a connection Send some data over the connection Receive some data over the connection Release the connection

Kyung Hee University

Socket primitives for TCP/IP


42/63

Message-Orient Transient Communication


u Berkeley Sockets:
Create a new endpoint Associate endpoint Reserve buffer Block waiting for reqs

Automatic binding after connection

Connection-oriented communication pattern using sockets


Kyung Hee University 43/63

Message-Orient Transient Communication


u Sockets ware deemed insufficient because:
u Support only send and receive primitives u Designed for communication using general-purpose protocol stacks such as TCP/IP

u ->The Message-Passing Interface (MPI)


u Designed for multiprocessor machines and high-performance parallel programming u Provides a high-level of abstraction than sockets u Support diverse forms of buffering and synchronization (over 100 functions)

Kyung Hee University

44/63

Message-Orient Transient Communication


u The Message-Passing Interface (MPI)
Primitive MPI_bsend MPI_send MPI_ssend MPI_sendrecv MPI_isend MPI_issend MPI_recv MPI_irecv Meaning Append outgoing message to a local send buffer Send a message and wait until copied to local or remote buffer Send a message and wait until receipt starts Send a message and wait for reply Pass reference to outgoing message, and continue Pass reference to outgoing message, and wait until receipt starts Receive a message; block if there are none Check if there is an incoming message, but do not block

Some of the most intuitive message-passing primitives of MPI.


Kyung Hee University 45/63

Message-Orient Persistent Communication


u Message-Queue Model
u Apps communicate by inserting messages in specific queues u Loosely-couple communication u Support for: u Persistent asynchronous communication u Longer message transfers (e.g., e-mail systems) Four combinations for loosely-coupled communications using queues.

Kyung Hee University

46/63

Message-Orient Persistent Communication


u General Architecture of a Message-Queuing System
u Messages can only be put and received from local queues. u The message-queuing system is responsible for transmitting the messages between the source queues and destination queues, meanwhile storing the messages as long as necessary. u Each queue is maintained by a queue manager. Example

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


Kyung Hee University 47/63

Message-Orient Persistent Communication


u General Architecture of a Message-Queuing System
u 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

Kyung Hee University

48/63

Message-Orient Persistent Communication


u Generalpurpose System
u u u u

of

Message-Queuing

Enable persistent communication between processes Handling access to database Perform computation In wide range of application, include: -Email -Workflow -Groupware -Batch processing

Kyung Hee University

49/63

Message-Orient Persistent Communication


u Message Brokers

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

Kyung Hee University

end

50/63

5-Stream-Oriented Communication

Kyung Hee University

51/63

Kyung Hee University

52/63

* Relationship between substreams are also timedependent Kyung Hee University

53/63

Data Stream (1)


Setting up a stream between two processes across a network.

Setting up a stream directly between two devices.

Kyung Hee University

54/63

Data Stream (2)

An example of multicasting a stream to several receivers.


Kyung Hee University 55/63

Client Traffic Shaping

Kyung Hee University

56/63

Specifying QoS (1)


Characteristics of the Input maximum data unit size (bytes) Token bucket rate (bytes/sec) Toke bucket size (bytes) Maximum transmission rate (bytes/sec) Service Required Loss sensitivity (bytes) Loss interval (sec) Burst loss sensitivity (data units) Minimum delay noticed (sec) Maximum delay variation (sec) Quality of guarantee

A flow specification. Question: who specifies the flow?


Kyung Hee University 57/63

Specifying QoS (2)

The principle of a token bucket algorithm.

Kyung Hee University

58/63

Resource ReSerVation Protocol (RSVP)


A transport-level control protocol
Used to provide QoS for continuous data streams by reserving resources {Bandwidth, buffers, and processing capacity} Issue: how to translate QoS parameters to resource usage?

2 ways to translate
RSVP translates QoS parameters into data link layer parameters
Kyung Hee University

Data link layer provides its own set of parameters (as in ATM)

59/63

Setting Up a Stream (1)

Kyung Hee University

The basic organization of RSVP for resource reservation in a distributed system.


60/63

Setting Up a Stream (2)

Kyung Hee University

61/63

Setting Up a Stream (3)

Kyung Hee University

62/63

Setting Up a Stream (4)

Kyung Hee University

63/63

Kyung Hee University

64/63

Synchronization Mechanisms (1)

The principle of explicit synchronization on the level data units.


Kyung Hee University 65/63

Synchronization Mechanisms (2)

2-41

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


Kyung Hee University

message

66/63

END OF CHAPTER 2

THANK YOU FOR JOINING US!


Kyung Hee University 67/63

You might also like