Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University

Similar presentations


Presentation on theme: "EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University"— Presentation transcript:

1 EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org

2 2 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Outline Inter-process communications Remote Procedure Call Remote Method Invocation

3 3 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Inter-Process Communications Techniques: –Shared memory –Message passing Objectives: –Data exchange –Synchronization: processes at different hosts, executing at different rates, need to influence the overall execution pattern => Constraints on the order of events

4 4 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao The OSI Network Architecture

5 5 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Low-level Layers Physical layer: contains the specification and implementation of bits, and their transmission between sender and receiver Data link layer: prescribes the transmission of a series of bits into a frame to allow for error and flow control Network layer: describes how packets in a network of computers are to be routed

6 6 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Transport Layer The transport layer provides the actual communication facilities for most distributed systems. TCP: connection-oriented, reliable, stream-oriented communication UDP: unreliable (best-effort) datagram communication

7 7 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Application Layer Many application protocols are directly implemented on top of transport protocols that do a lot of application- independent work FTPWWW TransferFTPHTTP Encoding7-bit text + 8-bit binary8-bit + content type NamingHost + pathURL ReplicationCaching + DNS tricks

8 8 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Message Layout

9 9 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Middleware Layer Middleware is invented to provide common services and protocols that can be used by many different applications: –A rich set of communication protocols –Marshaling and unmarshaling of data –Naming protocols –Security protocols –Scaling mechanisms What remains are truly application-specific protocols

10 10 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao An Adapted Reference Model with Middleware Layer 2-5

11 11 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Conventional Procedure Call Parameter passing in a local procedure call: the stack before the call to read() The stack while the called procedure is active count = read(fd, buf, bytes);

12 12 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Parameter Passing in Conventional Procedure Call Passing by value Passing by reference fd = 10; bytes = 1024; buf = 0x01400000; count = read(fd, buf, bytes); buffer 0x01400000 which parameter to read() is passed by value and which is passed by reference?

13 13 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Remote Procedure Call Observations: –Application developers are familiar with simple procedure model –Well-engineered procedures operate in isolation (black box) –There is no fundamental reason not to be able to execute procedures on separate machine Conclusion: communication between caller & callee can be hidden by using procedure-call mechanism

14 14 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Client and Server Stubs Remote Procedure Call (RPC) achieves distribution transparency by using a client stub and a server stub The client stub provides the interface of the procedure call => illusion of a local call interface –It packs the parameters into a message and requests that message be sent to the server The server stub is a piece of code that transforms requests coming in over the network into local procedure calls

15 15 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao RPC between Client and Server

16 16 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Steps of Remote Procedure Call

17 17 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Parameter Passing for RPC Marshaling: must convert the parameters into a message Marshaling is not trivial: –Client and server machines may have different data representations (think of byte ordering) –Wrapping a parameter means transforming a value into a sequence of bytes –Client and server have to agree on the same encoding –Client and server need to properly interpret messages, transforming them into machine-dependent representations

18 18 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Parameter Passing A procedure The corresponding message

19 19 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao External Data Representation Data structures: –“flattened” on transmission –rebuilt upon reception Primitive data types: –Byte order (big-endian: MSB comes first) –ASCII vs UNICODE (2 bytes per character) –Marshalling/unmarshalling To/from agreed external format

20 20 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao External Data Representation XDR (RFC 1832), CDR (CORBA), Java: –data -> byte stream –object references HTTP/MIME: –data -> ASCII text

21 21 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao CORBA CDR Example The flattened form represents a Person struct with value: {‘Smith’, ‘London’, 1934} 0–3 4–7 8–11 12–15 16–19 20-23 24–27 5 "Smit" "h___" 6 "Lond" "on__" 1934 index in sequence of bytes4 bytes notes on representation length of string ‘Smith’ length of string ‘London’ unsigned long

22 22 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Interface Definition Language In order to allow servers to be accessed by different clients, Interface Definition Language (IDL) is usually used to allow various platforms to call the RPC –The first popular implementation of RPC on Unix was Sun's RPC, which was used as the basis for NFS From IDL, client and server stubs can be generated automatically to facilitate development

23 23 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Parameter Passing While passing value parameters is relatively straightforward, passing reference parameters is difficult –A pointer is meaningful only within the address space of the process in which it is being used If we introduce a remote reference mechanism, access transparency can be enhanced: –Remote reference offers unified access to remote data –Remote references can be passed as parameter in RPCs

24 24 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Asynchronous RPC The interconnection between client and server in a traditional RPC The interaction using asynchronous RPC

25 25 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Asynchronous RPC A client and server interacting through two asynchronous RPCs. This scheme is also called deferred synchronous RPC

26 26 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Remote Distributed Objects Data and operations encapsulated in an object Operations are implemented as methods, and are accessible through interfaces Object offers only its interface to clients Object server (or host server) is responsible for a collection of objects Server skeleton handles (un)marshaling and object invocation Client stub (proxy) implements interface

27 27 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Distributed Objects

28 28 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Client-to-Object Binding Object reference: denotes server, object, and communication protocol. Having an object reference allows a client to bind to an object: –Client loads associated stub code –Stub is instantiated and initialized for specific object Two ways of binding: –Implicit: Invoke methods directly on the referenced object –Explicit: Client must first explicitly bind to object before invoking it

29 29 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Remote Method Invocation Steps Client invokes method at stub Stub marshals request and sends it to server Server ensures referenced object is active Request is unmarshaled by object’s skeleton, and referenced method is invoked Result is marshaled and passed back to client Client stub unmarshals reply and passes result to client application

30 30 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao RMI: Parameter Passing Passing objects by value: A client may pass a complete object as parameter value: –An object has to be marshaled: Marshall its state Marshall its methods, or give a reference to where an implementation can be found –Server unmarshals object. Note that we have now created a copy of the original object

31 31 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao RMI: Parameter Passing Passing objects by reference: Much easier than in the case of RPC: –One can simply bind to referenced object, and invoke methods –Unbind when referenced object is no longer needed

32 32 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Parameter Passing Passing an object by reference or by value


Download ppt "EEC-681/781 Distributed Computing Systems Lecture 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University"

Similar presentations


Ads by Google