1 Chapter 2. Communication
STEM-PNU 2 Layered Protocol TCP/IP : de facto standard Our Major Concern Not always 7-layered Protocol But some other protocols if necessary
STEM-PNU 3 Client-Server Model TCP/IP Client-Server Model
STEM-PNU 4 Basic Operations of Client-Server Model (Send and Receive Protocol) Client … txmsg.opcode=opcode; txmsg.source=me; txmsg.param=param; sendMessage(serverID,&txmsg); waitMessage(serverID,&rxmsg); checkAndProcess(rxmsg); Client Server While(1) { waitMessage(FromAny,&rxmsg); source=rxmsg.source; opcode=rxmsg.opcode; param=rxmsg.params; result=functions[opcode](param); txmsg.result=result; txmsg.source=me; sendMessage(source,&txmsg); }
STEM-PNU 5 Steps of RPC 1. Client procedure calls client stub in normal way 2. Client stub builds message, calls local OS 3. Client's OS sends message to remote OS 4. Remote OS gives message to server stub 5. Server stub unpacks parameters, calls server 6. Server does work, returns result to the stub 7. Server stub packs it in message, calls local OS 8. Server's OS sends message to client's OS 9. Client's OS gives message to client stub 10. Stub unpacks result, returns to client
STEM-PNU 6 RPC : Remote Procedure Call Client … txmsg.opcode=opcode; txmsg.source=me; txmsg.param=param; sendMessage(serverID,&txmsg); waitMessage(serverID,&rxmsg); checkAndProcess(rxmsg); Server result=funcA(param); txmsg.opcode=opcode; txmsg.source=me; txmsg.param=param; sendMessage(serverID,&txmsg); waitMessage(FromAny,&rxmsg); source=rxmsg.source; opcode=rxmsg.opcode; param=rxmsg.params; result=functions[opcode](param); funcA STUB
STEM-PNU 7 Binding a Client to a Server Binding in DCE (Distributed Computing Environment)
STEM-PNU 8 Middleware Client Stub for Client Server Stub for Server Binding (Dynamic) Middleware
STEM-PNU 9 Middleware Protocol
STEM-PNU 10 OS Some Issues : Reliable vs. Non-Reliable ClientServer Process OS 1. Request 2. Reply If reply message is lost? 1. Blocking 2. Acknowledge 3. Idempotent
STEM-PNU 11 Some Issues : Blocking vs. Non-Blocking Blocking (No Buffer, Synchronous) Client Server Send Kernel Trap Server Processing Send Receive Blocked
STEM-PNU 12 Some Issues : Blocking vs. Non-Blocking Non-Blocking (No Buffer, Asynchronous) Client Server Send Copy to system buffer Process other task Server Processing Send Receive Blocked
STEM-PNU 13 Asynchronous RPC If client does not receive return value, No reason to be blocked. Asynchronous RPC
STEM-PNU 14 Asynchronous RPC Even though client does receive return value, Two asynchronous RPC
STEM-PNU 15 Some Issues : Parameter Passing
STEM-PNU 16 Parameter Passing for Objects Two types of Object Parameter Passing Object Copy vs. Reference Copy Should it be transparent ?
STEM-PNU 17 Remote Object Invocation Generalization of RPC to Object Invocation Implementation of object interface like client stub in RPC
STEM-PNU 18 Marshalling System A Object in Main Memory System B Object Object in Main Memory MarshallingDemarshalling When objects in memory are to be passed across a network to another host or persisted to storage, their in-memory representation must be converted to a suitable out-of-memory format. This process is called marshalling, and converting back to an in memory representation is called demarshalling
STEM-PNU 19 Extended RPC : Door for Single Machine Client and Server are located in a single machine RPC for processes on the same machine 1 2 3
STEM-PNU 20 RMI : Object Binding Implicit Binding Distr_object* obj_ref;//Declare a system-wide object reference obj_ref = …;// Initialize the reference to a distributed object obj_ref-> do_something();// Implicitly bind and invoke a method Explicit Binding Distr_object objPref; //Declare a system-wide object reference Local_object* obj_ptr; //Declare a pointer to local objects obj_ref = …; //Initialize the reference to a distributed object obj_ptr = bind(obj_ref); //Explicitly bind and obtain a pointer to the local proxy obj_ptr -> do_something();//Invoke a method on the local proxy
STEM-PNU 21 Stream-Oriented Communication In distributed environment Continuous Media : e.g. video Discrete Media : e.g. Simple File Transfer Temporal Aspects of Data Stream Asynchronous Transmission Synchronous Transmission Isochronous Transmission Composition of Stream Simple Stream Complex Stream : composed of simple or complex streams Synchronization is very important
STEM-PNU 22 Data Streaming
STEM-PNU 23 QoS : Quality of Service Timeline, Volume and Reliability
STEM-PNU 24 Group Communication Send to a group Send to a machine Send to multiple receivers
STEM-PNU 25 Group Communication : Design Issues Closed or Open Peer or Hierarchical Addressing Multi-Casting or Broadcasting Uni-casting Predicate Addressing Open to outside Closed to outside
STEM-PNU 26 Group Communication : Design Issues Group Membership Send/Receive Protocol How to distinguish it from single receive Atomicity Message ordering Scalability