1 communication chapter 2. 2 layered protocols (1) layers, interfaces, and protocols in the osi...

53
1 Communication Chapter 2

Upload: camron-henry

Post on 02-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

1

Communication

Chapter 2

Page 2: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

2

Layered Protocols (1) Layers, interfaces, and protocols in the OSI model.

Page 3: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

3

Layered Protocols (2) A typical message as it appears on the network.

Page 4: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

4

Data Link Layer

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

Page 5: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

5

Client-Server TCP

Page 6: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

6

Middleware Protocols

An adapted reference model for networked communication.

Page 7: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

7

Remote Procedure Call Remote Procedure Call (RPC)

Definition: Information can be transported from the caller to the callee in the parameters and can come back in the procedure result.

Problems Calling and called procedures run on different

machine Executed in different address spaces (more

complications) Passing parameters and results (especially in not

identical or typos) Machine crash or failure when execution

Page 8: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

8

Conventional Procedure Call fd: an integer indicating a file buf: an array using call-by-copy/restore nbytes: how many bytes to read

a) Parameter passing in a local procedure call: the stack before the call to read

b) The stack while the called procedure is active

Page 9: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

9

Client and Server Stubs Put a different version of read in the client’s

library Client stub

Server-side equivalent of a client stub Server stub

Principle of RPC between a client and server program.

Page 10: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

10

Steps of a Remote Procedure Call

1. Client procedure calls client stub in normal way2. Client stub builds message, calls local OS3. Client's OS sends message to remote OS4. Remote OS gives message to server stub5. Server stub unpacks parameters, calls server6. Server does work, returns result to the stub7. Server stub packs it in message, calls local OS8. Server's OS sends message to client's OS9. Client's OS gives message to client stub10. Stub unpacks result, returns to client

Page 11: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

11

Passing Value Parameters (1/2) Parameter Marshaling

Packing parameters into a message

Steps involved in doing remote computation through RPC

Page 12: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

12

Passing Value Parameters (2/2) Problems

Different char. representations IBM mainframe: EBCDIC character code IBM PC: ASCII character code

Different math. representations One’s complement vs. two’s complement

Data storing way Intel Pentium: store numbers from right to left Sun SPARC: from left to right

How to pass pointers & references

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

Page 13: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

13

Parameter Specification and Stub Generation Defining the message format is one aspect

of an RPC protocol A standard of data structure representation An interface consists of a collection of

procedure that can be called by a client. Interface: Interface Definition Language (IDL)

a) A procedureb) The

corresponding message.

Page 14: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

14

Extended RPC Models

Need OS support!!

Performance Concern RPC message exchange will cost a lot because they reside in different

machines. IPC (local interprocess communication) can overcome this problem since

they are used in the same machine. Doors

A generic name for a procedure in the address space of a server process that can be called by processes colocated with the server.

A similar mechanism is called Lightweight RPC. A registered door (registered to OS) can be made available to other

processes

Page 15: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

15

Asynchronous RPC (1/2) To overcome the drawback of RPC client’s

waiting. Asynchronous RPC can be made both either

concurrently. Combining two asyn. RPCs is sometimes referred

to as a deferred synchronous RPC. Note that “one-way RPCs” don’t need

server to reply an ACK back to the client.

Page 16: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

16

Example: DCE RPC DCE (Distributed Computing Environment)

Developed by the Open Software Foundation (OSF)

A middleware system Initially designed for UNIX, now in VMS and

Windows NT Some famous services of the DCE

Distributed file service Directory service Security service Distributed time service

DCE RPC enables a client to access a remote service by simply calling a local procedure.

Page 17: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

17

Writing a Client and a Server Using Interface Definition Language (IDL) IDL files contain

type definitions, constant declarations, and information needed to marshal parameters

Formal definition of what the procedures do The syntax of the calls Globally unique identifier for specified interface

Writing client/server DCE RPC (See next page) First, using uuidgen program to generate a prototype IDL

file Second, editing the IDL file, filling the names of the

procedures and their parameters. Call IDL compiler to generate 3 files: the header file, the

client stub, and the server stub Finally, programmer write the client and server code.

Page 18: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

18

Writing a Client and a Server

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

Page 19: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

19

Binding a Client to a Server How a client can call a server

It is necessary that the server be registered and prepared to accept incoming calls.

Server location announcement 1. Locate the server’s machine 2. Locate the server (i.e., the correct process) on that machine.

The client needs to know an endpoint, (also known as port) which is used by the server’s OS to distinguish incoming messages for diff. processes.

In DCE, a table of (server, endpoint)-pairs is maintained on each server machine by a process called DCE daemon.

Client-to-server binding in DCE.

Page 20: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

20

Remote Object Invocation Object encapsulates data, called the state, and the

operations on those data called methods. Methods are made available through an interface. The interface and the objects can be placed in different

machine. Client binds to a distributed object (DO), an implementation

of the object’s interface, called a proxy. Skeleton, a server stub, used to unmarshal invocation

requests to proper method invocations at the object’s interface at the server.

Page 21: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

21

Compile-time vs. Runtime Objects A class is a description of an abstract type in terms

of a module with data elements and operations on that data.

Compile-time Advantage: easy to build distributed app. Drawbacks: the dependency on a particular PL.

Runtime Advantage: distributed objects had been written. It’s easy to constructing distributed app. by using objects

in different language. Persistent and Transient Objects

Persistent objects are alive on the server all the time. Transient objects exist only as long as the server manages

the object.

Page 22: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

22

Binding a Client to an Object

a) (a) Example with implicit binding using only global referencesb) (b) Example with explicit binding using global and local references

Distr_object* obj_ref; //Declare a systemwide object referenceobj_ref = …; // Initialize the reference to a distributed objectobj_ref-> do_something(); // Implicitly bind and invoke a method

(a)

Distr_object* obj_ref; //Declare a systemwide object referenceLocal_object* obj_ptr; //Declare a pointer to local objectsobj_ref = …; //Initialize the reference to a distributed objectobj_ptr = bind(obj_ref); //Explicitly bind and obtain a pointer to the local proxyobj_ptr -> do_something(); //Invoke a method on the local proxy

(b)

Page 23: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

23

Static vs. Dynamic RMI Remote Method Invocation (RMI)

Static invocation The interfaces of an object are known when the client

application is being developed If interfaces change, the client application must be

recompiled. Dynamic invocation

invoke(object, method, input_parameters, output_parameters);

object: distributed object; method: method to be invoked; input_para: data structure; output_para: data structure

For example Static: fobject.append(int) Dynamic: invoke(fobject, id(append), int)

has been known

returns an id for the method append

Page 24: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

24

Parameter Passing The situation when passing an object by reference or by

value.

2-18

Page 25: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

25

The DCE Distributed-Object Model

a) Distributed dynamic objects in DCE.b) Distributed named objects

Page 26: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

26

Persistence and Synchronicity in Communication (1) General organization of a communication system in which

hosts are connected through a network

2-20

Page 27: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

27

Persistence and Synchronicity in Communication (2) Persistent communication of letters back in the days of the

Pony Express.

Page 28: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

28

Persistence and Synchronicity in Communication (3)

a) Persistent asynchronous communicationb) Persistent synchronous communication

2-22.1

Page 29: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

29

Persistence and Synchronicity in Communication (4)

c) Transient asynchronous communicationd) Receipt-based transient synchronous communication

2-22.2

Page 30: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

30

Persistence and Synchronicity in Communication (5)

e) Delivery-based transient synchronous communication at message delivery

f) Response-based transient synchronous communication

Page 31: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

31

Berkeley Sockets (1) 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

Close Release the connection

Page 32: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

32

Berkeley Sockets (2)

Connection-oriented communication pattern using sockets.

Page 33: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

33

The Message-Passing Interface (MPI) MPI is used in local communication system Socket, in contrast with MPI, has two

drawbacks Wrong level of abstraction by supporting send

and receive primitives. Using general protocol stacks, TCP/IP

Socket is not suitable for COWs (Cluster of Workstations) or MPPs (Massively Parallel Processors)

MPI is designed for parallel applications MPI use (groupID, processID) to replace

TCP/IP.

Page 34: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

34

The Message-Passing Interface (MPI) Some of the most intuitive message-passing primitives of

MPI.

Primitive Meaning

MPI_bsend 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

Page 35: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

35

Message-Queuing Model (1/2) Also called as Message-Oriented Middleware (MOM) Intermediate-term storage capacity for messages,

without requiring either the sender or receiver to be active during message transmission.

Difference with Berkeley socket and MPI Applications communicate by inserting messages

in specific queues. A queue can be read only by its associated

application, but it is also possible for multiple applications to share a single queue.

Loosely-coupled communication Like the Internet e-mail system Allow a process to install a handler as a callback

function, which is automatically invoked whenever a message is put into the queue.

Page 36: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

36

Message-Queuing Model (2/2) Four combinations for loosely-coupled communications using

queues.

Page 37: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

37

Message-Queuing Model (2) Basic interface to a queue in a message-queuing system.

Primitive Meaning

Put Append a message to a specified queue

GetBlock until the specified queue is nonempty, and remove the first message

PollCheck a specified queue for messages, and remove the first. Never block.

NotifyInstall a handler to be called when a message is put into the specified queue.

Page 38: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

38

General Architecture of a Message-Queuing System (1/3) The relationship between queue-level addressing and

network-level addressing.

Page 39: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

39

General Architecture of a Message-Queuing System (2/3)

Source queue Local to the sender On the same machine or on a machine nearby

such as on the same LAN. Destination queue

Local to the receiver Queue manager

Interacts directly with the application that is sending or receiving a message

Relays Special queue managers that operate as routers

Page 40: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

40

General Architecture of a Message-Queuing System (3/3) The general organization of a message-queuing system with

routers.

Page 41: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

41

Message Brokers The problem of integrating existing and new applications into

a single, coherent distributed information system. Acts as an application-level gateway To convert incoming messages to a format that can be

understood by the destination application. Simple as a reformatter for messages. The general organization of a message broker in a message-

queuing system.

Page 42: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

42

Example: IBM MQSeries General organization of IBM's MQSeries message-queuing

system.

Page 43: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

43

Channels Some attributes associated with message channel agents.

Attribute Description

Transport type Determines the transport protocol to be used

FIFO delivery Indicates that messages are to be delivered in the order they are sent

Message length Maximum length of a single message

Setup retry count

Specifies maximum number of retries to start up the remote MCA

Delivery retries Maximum times MCA will try to put received message into queue

Page 44: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

44

Message Transfer (1) The general organization of an MQSeries queuing network

using routing tables and aliases.

Page 45: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

45

Message Transfer (2)

Primitives available in an IBM MQSeries MQI

Primitive Description

MQopen Open a (possibly remote) queue

MQclose Close a queue

MQput Put a message into an opened queue

MQget Get a message from a (local) queue

Page 46: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

46

Data Stream (1/3) Continuous media

The temporal relationships between different data items are fundamental to correctly interpreting what the data actually means.

Discrete media The temporal relationships between different data items

are not fundamental to correctly interpreting the data. Data stream

Nothing but a sequence of data units.

Page 47: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

47

Data Stream (2/3) Asynchronous transmission mode

The data item in a stream are transmitted one after the other, but there are no further timing constraints on when transmission of items should take place.

Synchronous transmission mode There is a maximum end-to-end delay defined for each

unit in a data stream Isochronous transmission mode

It is necessary that data units are transferred on time. Data transfer is subject to a maximum and minimum end-

to-end delay, also referred to as bounded (delay) jitter.

Page 48: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

48

Data Stream (3/3) Simple stream

Consists of only a single sequence of data Complex stream

Consists of several related simple stream, called substreams.

Main problem with multicast streaming is when the receivers have different requirements with respect to the quality of the stream.

Filter

Page 49: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

49

Streams and Quality of Service (QoS) Quality of Service (QoS)

Time-dependent (and other nonfunctional) requirements are generally expressed as

Flow specification Bandwidth requirements, transmission rates,

delays, etc. Token bucket algorithm

How the stream will shape its network traffic

Page 50: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

50

Specifying QoS

A flow specification.

Characteristics of the Input Service Required

maximum data unit size (bytes)Token bucket rate (bytes/sec)Toke bucket size (bytes)Maximum transmission rate (bytes/sec)

Loss sensitivity (bytes)Loss interval (sec)Burst loss sensitivity (data units)Minimum delay noticed (sec)Maximum delay variation (sec)Quality of guarantee

Page 51: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

51

Setting Up a Stream Resource reSerVation Protocol (RSVP)

A transport-level control protocol for enabling resource reservation in network routers.

Does not interpret the flow specification Receiver-initiated QoS protocol

In fact, to make RSVP work, the RSVP process will have to translate the QoS parameters of its flow specifications into things that make sense to the data link layer.

Page 52: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

52

Synchronization Mechanisms (1) The principle of explicit synchronization on the level data

units.

Page 53: 1 Communication Chapter 2. 2 Layered Protocols (1)  Layers, interfaces, and protocols in the OSI model

53

Synchronization Mechanisms (2) The principle of synchronization as supported by high-level

interfaces.

2-41