Top Banner
1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams
62

1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

Dec 19, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

1

Communication

Inter-process Communication is the heart of a Distributed System

Basic mechanisms are:•RPC•RMI•MOM•Streams

Page 2: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

2

How to Communicate?

• Problem: a process in machine A wants to communicate (an item) to a process in machine B

How is this done?

• Build a message and send it through the network (cable) to the “other” side.

MANY things have to be agreed upon!1. Voltage (0/1)? For bit representation..2. Correctness of messages3. Representation of numbers, strings, and data items(in different

machines)4. Etc.

Page 3: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

3

Approach: OSI Layered Protocols

OSI Open System Interconnection Reference:Layers, interfaces, and protocols in the OSI model.

2-1

Page 4: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

4

Layered Protocols: as you dip into the layers you “add” more info

A typical message as it appears on the network.

2-2

Page 5: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

5

OSI ModelDesign for “Open System”: allows the communication

of one system with another – possibly different one.

Open Systems are not exactly “Open” ; They are governed by a set of rules/regulations…

• Protocols: formalization of these rules

• Connection-oriented protocols

• Connectionless protocols.

Page 6: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

6

Physical LevelMostly concerned with the transmission of 0/1s..

• Voltage level

• Rate of transmission

• Network connectors (plugs)

Example:

RS232c (standard for serial communication).

Page 7: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

7

Data Link Layer: frames & checksums

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

2-3

Page 8: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

8

Network Layer• Does the “routing” of packets..

• Problem: shortest path is not always available!!

• Even if it is available “routing” may opt for a different path? Why?

• IP Internet Protocol (main representative of Network Layer)

• An IP packet (frame) can be sent without any setup.

• Virtual Path is gaining popularity (in ATM networks)

Page 9: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

9

Transport LayerData will have to delivered to the other side

with no loss..

The job of the TL is exactly this!

Examples..

• TCP (Transmission Control protocol)

• UDP (Universal Datagram Protocol): almost similar to IP.

• RTP (Real-Time Protocol)

Page 10: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

10

Example: Client-Server TCP

a) Normal operation of TCP.b) Transactional TCP (TCP for Transactions Suite)

2-4

Page 11: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

11

High(-er) Level Protocols.. • Session and Presentation Layer

– Provides dialog facilities, keeps track of who is talking at this time, and provides synchronization if needed.

– All these are useful into long transfers as precautions can be taken for the transmission of data.

• Examples:– FTP (file transfer protocol)– HTTP (HyperText Transfer Protocol)– TELNET, SSH

Page 12: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

12

Example of Higher Level Protocols: Middleware Protocols

An adapted reference model for networked communication that may enforce the notion of “atomicity”

2-5

Page 13: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

13

Communication of Processes-RPCs

[Birell & Nelson TOCS94]• When a process A in machine a calls a routine on

machine B, the calling process A suspends and the execution of the called program in B takes place transparently..

• Information is transported from caller to callee in the parameters and the result returns

• No message passing is visible to the user.• Remote Procedure Call (RPC).• Idea: make a remote procedure call appear as a local one!

Page 14: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

14

Conventional Procedure Call

a) Parameter passing in a local procedure call: the stack before the call to read (from main() )b) The stack while the called procedure is active

Page 15: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

15

Client and Server Stubs• The client stub works in a similar way to a usual

system call (for instance read()). • The difference is that a different version (the client

stub) is loaded into the frame stack.• This stub does not ask the OS to get any data on

behalf of the process.• The stub packs the parameters into a single message

and requests the message to be sent to the server.• When the msg arrives into the server, the OS of the

server surrenders the msg to the server stub (server side equivalent).

Page 16: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

16

Client and Server Stubs

Principle of RPC between a client and server program.

Page 17: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

17

Steps of a Remote Procedure Call1. 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 18: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

18

Possible Issues

Passing parameters is always a problem..

• Pass by value

• Pass by reference

• Call by copy/restore

Marshaling of parameters has to initially take place.

Page 19: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

19

Passing Value Parameters

Steps involved in doing remote computation through RPC

2-8

Page 20: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

20

Possible Problems with Passing Value Parameters

a) Original message on the Pentium (little Endian-number their bytes from right to left)

b) The message after receipt on the SPARC (big Endian-numbers the bytes from left to right)

c) The message after being inverted is not a general solution.d) The little numbers in boxes indicate the address of each byte

(need some type of deli-meter in order to understand the various representations involved)

e) integers and strings have to be handled differently!

Page 21: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

21

Passing Reference Parameters• How are pointers being passed??

– Generally difficult problem…– One solution is forbid passing of pointers all together

(rather restrictive)– Some things can be done with arrays:

• Copy the array into the message and send it over..

• Call-by-reference is replaced by copy/restore..

• If the stubs know whether the buffer is an Input parameter to the server or an output parameter to the client optimizations can be done.

Page 22: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

22

Parameter Specification and Stub Generation

En example.. • A procedure• The corresponding message.

•In order to hide the details of RPC some conventions (protocol) between theClient and the Servers have to be established.. •Representations (formats) of int, float, double, char, etc have to be •Be agreed upon.

RPC protocols can be established with IDL specs (that are compiledInto client/server stubs…)

Page 23: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

23

Extensions of RPCs:Doors[Hamilton & Kougiouris 94]

•What if caller/callee are in the same machine?? (classic IPC problem)•Door is a generic name for a procedure in the address space of a server process & can be called by processes colocated with the server.•Requires support from the local OS.

Plus: allows the use of procedure calls mechanism for a distributed system.

Minus: developers still need to be aware whether a call is done locally or remotely

Page 24: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

24

Asynchronous RPC

a) The interconnection between client and server in a traditional RPCb) The interaction using asynchronous RPC

2-12

Page 25: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

25

Asynchronous RPC

• A client and server interacting through two asynchronous RPCs• One-way RPCs

2-13

Page 26: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

26

Distributed Computing Environment(DCE)

Idea: take a group of machines (running Unix, OS2, Windows etc) add a layer of software and then be able to run distributed applications without disturbing the running of existing applications!

Some basic services offered such as:1. Distributed File Service (the worldwide file system)

2. Directory Service

3. Security Service

4. Distributed Time Service (why?)

Page 27: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

27

Writing a Client and a Server

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

2-14

Page 28: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

28

Binding a Client to a Server

• A client can call a server as long as the server is registered and ready to accept calls!

• Registration makes possible that the client can locate the server and bind to it.

Server location is down into two steps:• Locate the server’s machine• Locate the server (ie, the correct process on that machine!).

Page 29: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

29

Binding of Clients and Servers• In order to achieve the step (2) the port for the

service needs to be known.. (or endpoint)

• Ports are used by servers as different entry points to different procedure calls.

• In DCE there is a daemon (DCE Daemon) that makes this look up between (server, endpoint)

• The server also registers with a directory machine(name of machine and IP number)

Page 30: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

30

Binding a Client to a Server

Client-to-server binding in DCE.

2-15

•Example: a client wants to bind to a video server that is locally known as /local/multimedia/video/movies•DCE semantics

•Default: at-most-once operation•Otherwise: idempotent (done with the help of IDL)

•a remote Procedure call can be called a number of times.

Page 31: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

31

Remote Object Invocation

• Object-Oriented Technology (CORBA, DCOM) is another way to develop distributed applications.

• RPCs could be applied to those frameworks as well.• Object::

– Encapsulates data– Methods (operations on data)– Methods are available via interfaces– The differentiation between object & interfaces is critical

as far as Distributed Systems concerns.– Interface can be on one machine – Object on another.

Page 32: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

32

Distributed Objects

• Common organization of a remote object with client-side proxy.• Proxy = client stub ; Skeleton = Server Stub• The state of such distributed objects is NOT distributed!• A real-distributed object should be one that is physically distributed

across multiple machines.

2-16

Page 33: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

33

Page 34: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

34

Page 35: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

35

Implicit/Explicit Binding of a Client to an Object

a) An example with implicit binding using only global references

b) An example with explicit binding using global and local references (the client first calls a a special function that binds the object before the client can invoke the object’s methods)

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 objPref; //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 36: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

36

Types of Remote Method Invocation (RMI)

• Static Invocation– Interfaces of an object are know when client application

is being developed.

• Dynamic Invocation– Be able to compose a methods invocation at run time!– invoke(object, method, in_params, out_params)– Example: append an integer int to a file object fobject for

which the object provides the method append• Static: fobejct.append(int)• Dynamic: invoke(fobject, id(append), int) where id returns an

identifier for the method append.• Dynamic Invocation: when is it useful?

Page 37: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

37

Parameter Passing in RMI

Passing an object by reference or by value.

There are subtleties with RMI invocation (more so than with RPCs)References to remote/local objects are handled differently•When invoking a method with an object reference as parameter

•Reference is copied and passed as a value parameter only when it refers to a remote object•When the reference is made on a local (client) object, the object is copies as a whole and passed along with the invocation

Page 38: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

38

Message Oriented Communication•RPCs & RMIs hide communication element of the interaction•In general both RPCs & RMIs are blocking•An alternative to those is communication based on messages•General organization for message-oriented communication is shown below

Page 39: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

39

Example: Mail-Server

• Every host is connected to one mail-server (can think of it as being the “comm” server of the picture in the previous slide).

• A client interface allows users to get access to the messages (located on the mail servers).

• When a user submits an message, the host forwards the message its corresponding mail server.

• Mail servers forward/delete messages.

Such a system is an example of persistent communication

Page 40: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

40

Mail-servers follow the Pony Express Model

Persistence has to do with the fact that the mail is stored as long as it takes to deliver it..

Transient Communication: if a message cannot be delivered to the next server/destination is discarded (typical of the transport layer – corresponds to store-and-forward router).

Page 41: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

41

Possible Combinations(sync/async-persi/transi)

a) Persistent asynchronous communicationb) Persistent synchronous communication(msg actually delivered to the

receiving site)

2-22.1

Page 42: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

42

Combos

c) Transient asynchronous communication (examples are UDP, asynchronous RPCs)

d) Receipt-based transient synchronous communication

2-22.2

Page 43: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

43

Combos

e) Delivery-based transient synchronous communication at message delivery

f) Response-based transient synchronous communication (RPCs & RMIs mostly adhere to this type of communication).

Page 44: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

44

Berkeley Sockets

Socket primitives for TCP/IP.

Primitive Meaning

Socket Create a new communication endpoint

Bind Attach a local address to a socket

ListenAnnounce willingness to accept connections

AcceptBlock 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

A socket is a communication endpoint to which the application from which can read data from or write data to.

Page 45: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

45

How Berkeley SocketsWork

Connection-oriented communication pattern using sockets.

Page 46: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

46

The MPI Interface

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

Primitive MeaningMPI_bsend Append outgoing message to a local send buffer

MPI_sendSend 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_issendPass 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

•MPI designed for parallel application programs (transient communication)•Communication happens among a group of known processes.

Page 47: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

47

Message-Queuing Systems

Four combinations for loosely-coupled communications using queues.

•Offer intermediate storage capacity for msgs•Good for transferring bulky message (in seconds) than simple messages (usually in milliseconds).•Important: sender is provided with the guarantee that her message will ultimately be inserted in the recipient’s queue.•Servers/receivers can execute completely independent of each other

Page 48: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

48

Message-Queuing Model: calls

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 49: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

49

General Architecture of a Message-Queuing System

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

• source queues, destination queues• database of queue names• queuing layer

Page 50: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

50

General Architecture of a Message-Queuing System

The general organization of a message-queuing system with routers.

2-29

•Relays can be good (in a messaging system)•Usually the queue-to-location mapping is managed statically•Otherwise, routers have to be used (in this case, relays can be used to build scalable messaging systems).

Page 51: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

51

Message Brokers

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

•Brokers are used to convert to various message types.•For example convert message from X.400 to Internet messages•The database can handle many such conversion rules.

Page 52: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

52

Stream-Oriented Communication

• Thus far, communication as long as it happens correctly is all we mind. Timing of this communication was not the issue.

• Timing is important in certain types of communication …– CD quality audio transmission ( 16bit samples at

44,1kHz)– Video streams

Page 53: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

53

Streams - Definitions

• Information Representation– Text with ASCII/Unicode

– Images with GIF/JPEG

– Audio Streams with 16bit samples using PCM

• Continuous (Representation) Media: temporal relationship among the different data items are fundamental to interpret what the data means.– Motion requires 30-40 msec per image (if represented as a

sequence of images).

• Discrete(Representation) Media: temporal relations among data items are not of essence – Representations of text, still-images, code, files, etc.

Page 54: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

54

Data Streams• Data stream: a sequence of data units

• Timing is essential into continuous data streams.

• Asynchronous Transmission Mode– Data are xmited one after the other with no “timing” strings

attached.

• Synchronous Transmission Mode– There is a maximum end-to-end delay defined for every unit in the

data stream.

• Isochronous Transmission Mode– Data have to be transferred on time

– There are minimum and maximum end-to-end delay (jitter)

Page 55: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

55

Data Streams

Setting up a stream between two processes across a network.

•Simple stream: single sequence of data•Complex stream: consists of several related simple streams (known as substreams)•A stream is often considered a (virtual) connection between a source and a sink.

Page 56: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

56

Data Streams with Direct Connection between Source and Sink

Setting up a stream directly between two devices.

Page 57: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

57

What if the sink is a multiparty?

• Receivers may have different requirements

• Filters have to be attached…

The data stream is multicast to several (receivers) sinks.

Page 58: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

58

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

Time-dependent requirements are collectively known as Quality of Service (QoS) requirements.

How one could define such a QoS? .. Via a flow spec

Page 59: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

59

Partridge’s Model expressed with a Token Bucket Algorithm

The principle of a token bucket algorithm.

•This model specifies how the stream will shape its network traffic•Idea: tokens appear in the network at a constant rate.

•When the bucket fills, tokens are dropped.•Each time the application wants to pass N bytes removes N/k tokens from the bucket (each token represents k bytes).

Page 60: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

60

Setting Up a Stream- RSVP Protocol

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

Page 61: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

61

Synchronization Mechanisms

The principle of explicit synchronization on the level data units.

•Complex Streams have to be synchronized.. •How is this done?

Page 62: 1 Communication Inter-process Communication is the heart of a Distributed System Basic mechanisms are: RPC RMI MOM Streams.

62

Synchronization Mechanisms

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

Multimedia Middleware offers a collection of interfaces• interfaces control audio/video streams• control devices such as mics, cameras, monitors• each device/stream has its own interface (used to write synchronization handlers).