Remote Communication I

Download Report

Transcript Remote Communication I

Distributed Systems
Lecture #3: Remote Communication
Communication
• Communication across address spaces
– Local
– Remote
• Same Rules apply
– Transparency
– Fault-isolation
– Consistency
Overview
• Mechanism
– Message Passing
• Abstractions
–
–
–
–
–
Message Passing
Synchronous: Procedure Calls
Asynchronous: Events
Coupled: Shared Memory
De-coupled: Tuple-spaces
Local Communication
How would 2 processes communicate?
• Message Passing: Sockets
• Shared Memory: Files
• Procedural call (across address space)?
• Ever used local RPC?
•Heard of OLE? COM?
RPC Enables Modularization
• Clients and Servers
– Better software engineering
• Well-defined interfaces between
• Client
• Service provider
– Fault-isolation
• Client failure does not affect the server
• Centralized consistency management
– Security
– Scalable Performance: Server not constrained by
client
Local RPC
• Transparency!
– Makes sense?
• Issues:
– What transpires in a subroutine call?
(Local) RPC Issues
• Transfer of control and data across
address spaces
– Binding
– Data Marshalling
– Thread Migration
– Synchronization
Remote RPC
• Same Issues
– BUT transparency makes sense?
• To what degree?
– Modularization
– Fault-isolation
• But masking?
• Failure may be partial
– Time?
• Consistency
– Scalable Performance?
Case Study: Sun RPC
• Used in NFS
• What does an RPC system consist of?
1. Standards for wire format of RPC msgs and data types. XDR, XML
2. Library of routines to marshal / unmarshal data.
3. Stub generator,
Client: marshal, invoke, wait, unmarshal reply.
For server: unmarshal arguments, invoke server function, marshal reply.
4. Server framework:
Dispatch each call message to correct server stub.
5. Client framework:
Give each reply to correct waiting thread / callback.
6. Binding: how does client find the right server?
Sun RPC
• What does a Sun RPC request contain?
• Wire format
–
–
–
–
–
–
–
–
Xid
Call orreply
RPC version
program #
program version
procedure #
auth bits
Marshalled arguments
Marshalling: Sun RPC
• Marshaling arguments
•
"Linearize" data
• "Externalize" data: Formats defined by XDR standard
Easy for e.g. int -- same representation, though portable byte
order...
Collections? include a length.
Pointers?
Pass by value of reference?
• Return Values
– How to return?
• IDL: In, Out, INOut
•
RMI: Objects
– Recursive packing
NFS Transparency
• Tension between performance and
consistency
– Syntax preserved
– Not Semantics
– File read/write semantics
• Only check on open()
• Consistency?
– Events!
• Expose Distribution: Java RMI