cs603 communication mechanisms 14 january 2002. types of communication shared memory message passing...

27
CS603 Communication Mechanisms 14 January 2002

Post on 22-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

CS603Communication Mechanisms

14 January 2002

Types of Communication

• Shared Memory

• Message Passing

• Stream-oriented Communications

• Remote Procedure Call

• Remote Method Invocation

Message Passing

• Basic model: mailing a letter– Package data– Has source (from address)– Delivered to recipient (to address)– Recipient is informed of delivery and can read at will

• Advantages– Low overhead– Simple model– Enables high concurrency

Message Passing (cont.)

• Disadvantages– No real programming model– No support for consistency

• Stock exercise – let’s build a semaphore

Message Passing: What else do we need to know?

• Delivery announcement– Poll– Signal/interrupt

• Quality of service– Bandwidth– Latency

• Addressing mechanisms

• Reliability!

Addressing Mechanisms

• Point-to-point– Obvious mechanism

• Multicast– Optimization over point-to-point

• Broadcast– NOT just optimized point-to-point

Reliability Example:Byzantine Agreement

• Introduced as voting problem (Lamport, Shostak, Pease ’82)

• A and B can defeat enemy iff both attack• A sends message to B: Attack at Noon!

General A General B

The Enemy

Byzantine Agreement

• Impossible with unreliable networks

• Possible if some guarantees of reliability– Guaranteed delivery within bounded time– Limitations on corruption of messages– Probabilistic guarantees (send multiple

messages)

CS603Communication Mechanisms

16 January 2002

Types of Communication

• Shared Memory

• Message Passing

• Stream-oriented Communications

• Remote Procedure Call

• Remote Method Invocation

Types of Reliability

• Delivery Guarantees– Always delivered

• Time bounds• “Eventual”

– Knowledge of delivery– Probabilistic guarantees

• Ordering – easy to solve at application end

• Message corruption

Interaction of Parameters

• Reliability and addressing– All-or-nothing multicast vs. partial delivery

No real analog in point-to-point

– Broadcast ordering

• Quality of Service tradeoffs– Fast unreliable broadcast vs. slow reliable

point-to-point

Types of Communication

• Shared Memory

• Message Passing

• Stream-oriented Communications

• Remote Procedure Call

• Remote Method Invocation

Stream-oriented Communications

• Telephone model– Matches some underlying hardware– Easy to implement on message passing model

• Advantages:– Higher level programming model

• Separation of addressing and sending

– Quality of Service easier• “Advance notice” of data transfer

– Some reliability “built-in” to model

Stream-oriented communications

• Disadvantages– Limited to point-to-point

• Multicast, broadcast harder to conceptualize

– Lack of flexibility• How to model unordered communications?

– Performance• Set-up times

Choosing between streams and message passing

• Is there repeated communication between participants?– How much do we know in advance?

• Multiple participants?– Is state between communications with each

participant important?

• Ordering important?

• Performance needs?

Types of Communication

• Shared Memory

• Message Passing

• Stream-oriented Communications

• Remote Procedure Call

• Remote Method Invocation

Remote Procedure Call

• Idea: Just like a procedure call– Control passes to new procedure– New procedure is on remote machine

• Advantages– Familiar programming model

• Procedural abstraction• Encapsulation of function

– Simple synchronization– Straightforward implementation?

Implementing RPC

• How do we do procedure call?– Push arguments– Push return address– Branch

• Remote:– Message with arguments, return address– Send– Wait for response

Implementing RPC:Why isn’t it this easy?

• Branch vs. Sending a message– Someone has to be listening!

• No shared environment– Global variables– Scope– What about passing pointers?

• Naming– How do we handle multiple procedures

“waiting” for RPC?

RPC: Disadvantages

• No concurrency– Must make concurrency explicit at caller

• Spawn thread before calling RPC• One thread waits for return, others continue

• Reliability questions– Retry? (at least once semantics)– Time out? (at most once semantics)

Handling failures left to application!

RPC vs. Communication-Oriented Protocols

• What does RPC give us?– Simple programming model

• What do we lose?– Simple concurrency model– Efficiency?– Flexible reliability models

Types of Communication

• Shared Memory

• Message Passing

• Stream-oriented Communications

• Remote Procedure Call

• Remote Method Invocation

Remote Method Invocation

• Object-Oriented RPC– Same basic concept– But some new complications

• Objects as arguments– How does remote object “invoke” argument?

• Pass code/data to execute argument locally?• Another RMI to run the argument?

– Same for resultsDoes it ever end?

Remote Method Invocation

• Differences from RPC– Communications overhead?– Can it be language-independent?

CS603Communication Mechanisms

18 January 2002

What is coming

• Remote procedure call – specific systems– DCE RPC– Java RMI– SOAP

• First project