Download - Distributed Systems
![Page 1: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/1.jpg)
Distributed Systems
Lecture #1: Remote Communication
![Page 2: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/2.jpg)
Communication• Communication across address spaces
– Local– Remote
• Same Rules apply
– Transparency– Fault-isolation– Consistency
![Page 3: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/3.jpg)
Overview• Mechanism
– Message Passing
• Abstractions– Message Passing– Synchronous: Procedure Calls– Asynchronous: Events– Coupled: Shared Memory– De-coupled: Tuple-spaces
![Page 4: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/4.jpg)
Layered Communication
Application
Distributed System (RPC)
Socket
OSTCP/IPUDP/IP
![Page 5: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/5.jpg)
Local CommunicationHow would 2 processes communicate?
• Message Passing: Sockets• Shared Memory: Files
• Procedural call (across address space)?• Ever used local RPC?
•Heard of OLE? COM?
![Page 6: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/6.jpg)
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
![Page 7: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/7.jpg)
Local RPC• Transparency!
– Makes sense?
• Issues:– What transpires in a subroutine call?
![Page 8: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/8.jpg)
RPC Components
Client Server
Stub Skeleton
Client Framework Server Framework
Network
![Page 9: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/9.jpg)
(Local) RPC Issues• Transfer of control and data across
address spaces– Binding– Data Marshalling– Thread Migration– Synchronization
![Page 10: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/10.jpg)
Remote RPC• Same Issues
– BUT transparency makes sense?• To what degree?
– Modularization– Fault-isolation
• But masking?• Failure may be partial
– Time? • Consistency
– Scalable Performance?
![Page 11: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/11.jpg)
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?
![Page 12: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/12.jpg)
Sun RPC• What does a Sun RPC request contain?• Wire format
– Xid
– Call orreply
– RPC version
– program #
– program version
– procedure #
– auth bits
– Marshalled arguments
![Page 13: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/13.jpg)
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 or reference?
• Return Values– How to return?
• IDL: In, Out, INOut
• RMI: Objects– Recursive packing
![Page 14: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/14.jpg)
RPC: Summary• Synchronous, Blocking• Mimics a procedural call• Involves:
– Data transfer: Marshaling– Thread Migration
![Page 15: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/15.jpg)
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
![Page 16: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/16.jpg)
Events• Subscribe/notify
• Asynchronous
• Non-blocking
Subscribe
Notify
![Page 17: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/17.jpg)
Events• Better performance than polling for larger tasks
– Do it, let me know when you are done
• Preferred mode of communication for interactive applications: none-blocking
• But Harder to program– Synchronization– Spaghetti code
![Page 18: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/18.jpg)
Programming Events
Main thread
Events Handler
Subscribe
Notify
![Page 19: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/19.jpg)
Distributed Shared Memory
Int x;x = 10;
Int x;..print x;
X = 10• Consistency?• Deadlock?• DSM abstraction?
• Make it explicit
![Page 20: Distributed Systems](https://reader035.vdocument.in/reader035/viewer/2022072016/568132af550346895d9964f0/html5/thumbnails/20.jpg)
Tuple-spaces
Tuple-space
• Explicit DSM• Tuple as the atomic data object • Clearly defined semantics for insert/read/peak