Distributed Systems - Chapter 2: Communication - Thoai Nam
Chapter 2: Communication
Issues in communication
Message-oriented Communication
Remote Procedure Calls
– Transparency but poor for passing references
Remote Method Invocation
– RMIs are essentially RPCs but specific to remote objects
– System wide references passed as parameters
Stream-oriented Communication
Bạn đang xem 20 trang mẫu của tài liệu "Distributed Systems - Chapter 2: Communication - Thoai Nam", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.
File đính kèm:
- distributed_systems_chapter_2_communication_thoai_nam.pdf
Nội dung text: Distributed Systems - Chapter 2: Communication - Thoai Nam
- Distributed Systems Thoai Nam Faculty of Computer Science and Engineering HCMC University of Technology
- Communication Protocols Protocols are agreements/rules on communication Protocols could be connection-oriented or connectionless Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Client-Server TCP a) Normal2-4 operation of TCP. b) Transactional TCP. Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Client-Server Communication Model Structure: group of servers offering service to clients Based on a request/response paradigm Techniques: – Socket, remote procedure calls (RPC), Remote Method Invocation (RMI) client file process terminal server server server kernel kernel kernel kernel Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Addressing Issues Question: how is the server user server located? Hard-wired address – Machine address and process address are known a priori user server Broadcast-based – Server chooses address from a sparse address space – Client broadcasts request NS user server – Can cache response for future Locate address via name server Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Buffering Issues Unbuffered communication – Server must call receive before clientuser server can call send Buffered communication – Client send to a mailbox – Server receives from a mailbox user server Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Remote Procedure Calls Goal: Make distributed computing look like centralized computing Allow remote services to be called as procedures – Transparency with regard to location, implementation, language Issues – How to pass parameters – Bindings – Semantics in face of errors Two classes: integrated into prog, language and separate Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Parameter Passing Local procedure parameter passing – Call-by-value – Call-by-reference: arrays, complex data structures Remote procedure calls simulate this through: – Stubs – proxies – Flattening – marshalling Related issue: global variables are not allowed in RPCs Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Stubs Client makes procedure call (just like a local procedure call) to the client stub Server is written as a standard procedure Stubs take care of packaging arguments and sending messages Packaging parameters is called marshalling Stub compiler generates stub automatically from specs in an Interface Definition Language (IDL) – Simplifies programmer task Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Example of an RPC 2-8 Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Binding Problem: how does a client locate a server? – Use Bindings Server – Export server interface during initialization – Send name, version no, unique identifier, handle (address) to binder Client – First RPC: send message to binder to import server interface – Binder: check to see if server has exported interface » Return handle and unique identifier to client Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Binder: Port Mapper Server start-up: create port Server stub calls svc_register to register prog. #, version # with local port mapper Port mapper stores prog #, version #, and port Client start-up: call clnt_create to locate server port Upon return, client can call procedures at the server Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Lightweight RPCs Many RPCs occur between client and server on same machine – Need to optimize RPCs for this special case => use a lightweight RPC mechanism (LRPC) Server S exports interface to remote procedures Client C on same machine imports interface OS kernel creates data structures including an argument stack shared between S and C Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Doors Which RPC to use? - run-time bit allows stub to choose between LRPC and RPC Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Asynchronous RPC 2-12 a) The interconnection between client and server in a traditional RPC b) The interaction using asynchronous RPC Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Remote Method Invocation (RMI) RPCs applied to objects, i.e., instances of a class – Class: object-oriented abstraction; module with data and operations – Separation between interface and implementation – Interface resides on one machine, implementation on another RMIs support system-wide object references – Parameters can be object references Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Proxies and Skeletons Proxy: client stub – Maintains server ID, endpoint, object ID – Sets up and tears down connection with the server – [Java:] does serialization of local object parameters – In practice, can be downloaded/constructed on the fly (why can’t this be done for RPCs in general?) Skeleton: server stub – Does deserialization and passes parameters to server and sends result to proxy Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM
- Message-oriented Transient Communication Many distributed systems built on top of simple message-oriented model – Example: Berkeley sockets Khoa Coâng Ngheä Thoâng Tin – Ñaïi Hoïc Baùch Khoa Tp.HCM