Top Banner
Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering Department The Chinese University of Hong Kong
35

© Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

Dec 13, 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: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 1

Distributed Systems

Topic 3: Communication

Dr. Michael R. LyuComputer Science & Engineering Department

The Chinese University of Hong Kong

Page 2: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 2

Outline

1 Communication Primitives

2 Client/Server Communication

3 Group Communication

4 CORBA Event Service

5 Summary

Page 3: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 3

1 Communication Primitives

Application

Presentation

Transport

Network

Data link

Physical

SessionThe ISO/OSI

Reference Model:

HTTP, FTP, Telnet

CORBA IIOP

XDR, CORBA Data

Secure Sockets (SSL)

for connection-

oriented comm.

message;

TCP, UDP

packet;IP;

ATM VC

error-free trans.

PPP, CSMA/CD

ISDN, baseband

signaling

host host

PSE PSE

PSE (packet switching exchange)

Page 4: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 4

1.1 ISO/OSI Transport Layer

Level 4 of ISO/OSI reference model.

Concerned with the transport of information through a network.

Two facets in UNIX networks: – TCP– UDP

Application

Presentation

Transport

Network

Data link

Physical

Session

connection oriented virtual connection w sequencing &

acknowledgement - connectionless- up to 64k bytes datagram- no seqs and acks

Page 5: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 5

1.1 ISO/OSI Transport Layer (TCP)

Transmission Control Protocol (TCP) provides bi-directional stream of bytes between two distributed components.

UNIX rsh, rcp and rlogin are based on TCP.

Reliable but slow protocol.

Buffering at both sides decouples computation speeds.

Page 6: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 6

1.1 ISO/OSI Transport Layer (UDP)

User Datagram Protocol (UDP) enables a component to pass a message containing a sequence of bytes to another component.

Other component is identified within message.

Unreliable but very fast protocol.

Restricted message length.

Queuing at receiver. UNIX rwho command is UDP based.

Page 7: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 7

1.2 ISO/OSI Presentation Layer

At application layer: complex data types

How to transmit complex values through transport layer?

Presentation layer issues:– Complex data structures and– Heterogeneity.

Application

Presentation

Transport

Network

Data link

Physical

Session

Page 8: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 8

1.2 Complex Data Structures

Marshalling: Disassemble data structures into a transmittable form

Unmarshaling: Re-assemble the complex data structure.

class Person {

private:

int dob;

char * name;

public:

char * marshal() {

char * msg;

msg=new char[strlen(name)+10];

sprintf(msg,”%d,%d,%s”, dob,

strlen(name),name);

return(msg);

};

};

Page 9: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 9

1.2 Heterogeneity

Heterogeneous data representation on different hardware platforms.

Approach 1 (Example XDR): – Define a shared representation,

– For each different platform, provide mapping between common and specific representation.

Approach 2 (Example ASN):

Page 10: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 10

1.3 Communication Patterns

Basic operations: send and receive messages (as in UDP).

Message delivery:– Synchronous or

– Asynchronous

Messages are used to model:– Notification and

– Request.

Page 11: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 11

1.3 Synchronous Communication

Time

sendersend

receiver

blocked

Transport Layer

receiveblocked

(1) (3) (4) (5)

ackn

(2)

Page 12: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 12

1.3 Communication Deadlocks

P1:

send() to P2;

receive() from P2;

P2:

send() to P1;

receive() from P1;

P1

P2

Waits-for

Components are mutually waiting for each other.

To avoid deadlocks: Waits-for relation has to be acyclic!

Page 13: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 13

1.3 Asynchronous Communication

Time

sendersend

receiver

Transport Layer

receiveblocked

(1) (3) (4)(2)

Page 14: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 14

1.3 Notification

Uni-directional communication Message contains marshaled

notification parameters.

send(...)

Notifier Notified

receive(...)

Page 15: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 15

1.3 Request

Bi-directional communication. Request message contains marshaled parameters. Requester receives reply message. Reply message contains marshaled results.

send(...)receive(...)

Requester Provider

receive(...)request

send(...)reply

...

Page 16: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 16

1.3 Reliability Issues

Unreliable message refers to message transmission without acknowledgement or retries (e.g., UDP).

A reliable delivery service may be constructed from an unreliable one by the use of ack.

Positive ack. for client-server communication and negative ack. for group multicast.

Reliable communication involves overheads. Each message should have a unique identifier.

Page 17: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 17

2 Client/Server Communication

Qualities of service.

Request protocol (R).

Request reply protocol (RR).

Request reply acknowledgement protocol (RRA).

Page 18: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 18

2.1 Qualities of service

Exactly once,

At most once,

At least once and

Maybe?

Page 19: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 19

2.2 Request Protocol

If service – does not have out or inout parameters and

– does not have a return type

client may not want to wait for server to finish.

execution requestsend(...)

Client Server

receive(...) exec op;

Page 20: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 20

2.3 Request/Reply Protocol

To be applied if client expects result from server. Client requests service execution from server through

request message. Delivery of service result in reply message.

send(...)

receive(...)

Client Server

receive(...) exec op;send(...)

request

reply

Page 21: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 21

2.4 RRA Protocol

In addition to RR protocol, client sends acknowledgement after it received reply.

Acknowledgement sent asynchronously.

send(...)

receive(...)send (...)

Client Server

receive(...) exec op;send(...)receive(...)

request

reply

ackn

Page 22: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 22

3 Group Communication

Client/server requests:– There is no other party involved.

– Client has to identify server.

Sometimes other properties are required:– Communication between multiple components.

– Anonymous communication.

Page 23: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 23

3.1 Concepts

Broadcast: Send msg to a group.

Multicast: Send msg to subgroup only.

MNN

NNNN

MM

N

NNNN

NN

NN

NN

NN

NN

N

Useful applications:Fault toleranceObject locationBetter performanceMultiple update

Page 24: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 24

3.2 Qualities of Service

Ideal: Immediate and reliable.

S

R1

R2Time

Optimal: Simultaneous and reliable.

S

R1

TimeR2

Page 25: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 25

3.2 Qualities of Service

In reality: not simultaneous ...

... and not reliable

TimeS

R1

R2

TimeS

R1

R2

Page 26: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 26

3.2 Qualities of Service

Problem: To achieve reliable broadcast/multicast is very expensive.

Degrees of reliability:– Best effort,

– K-reliability,

– totally ordered,

– Atomicity.

Choose the degree of reliability needed and be prepared to pay the price.

Page 27: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 27

3.3 CORBA Event Management

CORBA event management service defines interfaces for different group communication models.

Events are created by suppliers (producers) and communicated through an event channel to multiple consumers.

Service does not define a quality of service (left to implementers).

Page 28: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 28

3.3.1 Push Model

Consumers register with those event channel through which events they are interested in are communicated.

Event producers create a new event by invoking a push operation from an event channel.

Event channel notifies all registered consumers by invoking their push operations.

Page 29: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 29

3.3.1 Push Model (Example)

Share value updated

ProducerEvent

Channel

Redisplay chart

Redisplay table

Consumer Consumer

push(...) push(...) push(...)

Page 30: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 30

3.3.2 The Pull Model

Event producer registers its capability of producing events with event channel.

Consumer obtains event by invoking pull operation from event channel.

Event channel asks producer to produce event and delivers it to the consumer.

Page 31: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 31

3.3.2 Pull Model (Example)

Current

value: 76.10

ProducerEvent

Channel

Current share value?

Consumer Consumer

pull(...)pull(...)

Page 32: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 32

3.3.2 Event Channel

Event Channel

Direction of event transfer

Push supplier

Pull supplier

Push consumer

Pull consumer

Supported combinations:push suppliers, push consumerspush suppliers, pull consumerspull suppliers, push consumerspull suppliers, pull consumers

Page 33: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 33

3.3.2 Event Channel (with proxies)

Event Channel

Direction of event transfer

Push supplier

Pull supplier

Push consumer

Pull consumer

Proxy push consumer

Proxy pull consumer Proxy pull supplier

Proxy push supplier

Page 34: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 34

4 Summary

What communication primitives do we use? How are differences between application and

communication layer resolved? What quality of service do the client/server

protocols achieve that we discussed? What quality of services are involved in group

communication? CORBA Event Service for group communication. Read Textbook Chapter 3 through Chapter 4.

Page 35: © Chinese University, CSE Dept. Distributed Systems / 3 - 1 Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.

© Chinese University, CSE Dept. Distributed Systems / 3 - 35

Homework #1

1.7 Total 10 questions, 10 points each 1.11 1.13 Due: 7/10/2003 (Tuesday) in class 2.9 2.13 3.1 3.7 3.9 4.7 4.21