Date post: | 29-Dec-2015 |
Category: |
Documents |
Upload: | abraham-butler |
View: | 215 times |
Download: | 1 times |
1
Chapter 2. Communication
STEM-
PNU2
Layered Protocol
TCP/IP : de facto standard
Our Major Concern
Not always 7-layered Protocol
But some other protocols if necessary
STEM-
PNU3
Client-Server Model
TCP/IP
Client-Server Model
STEM-
PNU4
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
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-
PNU5
Steps of RPC
1. Client procedure calls client stub in normal way
2. Client stub builds message, calls local OS3. Client's OS sends message to remote OS4. Remote OS gives message to server stub5. Server stub unpacks parameters, calls server6. Server does work, returns result to the stub7. Server stub packs it in message, calls local OS8. Server's OS sends message to client's OS9. Client's OS gives message to client stub10. Stub unpacks result, returns to client
STEM-
PNU6
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-
PNU7
Binding a Client to a Server
Binding in DCE (Distributed Computing Environment)
STEM-
PNU8
Middleware
Client
Stub for Client
Server
Stub for Server
Binding (Dynamic)
Middleware
STEM-
PNU9
Middleware Protocol
STEM-
PNU10
OS
Some Issues : Reliable vs. Non-Reliable
Client Server
Process Process
OS
1. Request
2. Reply
If reply message is lost?
1. Blocking2. Acknowledge3. Idempotent
STEM-
PNU11
Some Issues : Blocking vs. Non-Blocking
Blocking (No Buffer, Synchronous)
Client
Server
Send
KernelTrap
ServerProcessing
Send
ReceiveBlocked
STEM-
PNU12
Some Issues : Blocking vs. Non-Blocking
Non-Blocking (No Buffer, Asynchronous)
Client
Server
Send
Copy tosystembuffer
Processother task
ServerProcessing
Send
Receive
Receive
Blocked
STEM-
PNU13
Asynchronous RPC
If client does not receive return value, No reason to be blocked. Asynchronous RPC
STEM-
PNU14
Asynchronous RPC
Even though client does receive return value, Two asynchronous RPC
STEM-
PNU15
Some Issues : Parameter Passing
STEM-
PNU16
Parameter Passing for Objects
Two types of Object Parameter Passing Object Copy vs. Reference Copy Should it be transparent ?
STEM-
PNU17
Remote Object Invocation
Generalization of RPC to Object Invocation
Implementation of object interface
like client stub in RPC
STEM-
PNU18
Marshalling
System A
Object inMain Memory
System B
Object
Object inMain Memory
Marshalling Demarshalling
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-
PNU19
Extended RPC : Door for Single Machine
Client and Server are located in a single machine
RPC for processes on the same machine
12
3
STEM-
PNU20
RMI : Object Binding
Implicit BindingDistr_object* obj_ref; //Declare a system-wide object referenceobj_ref = …; // Initialize the reference to a distributed objectobj_ref-> do_something(); // Implicitly bind and invoke a method
Explicit BindingDistr_object objPref; //Declare a system-wide object referenceLocal_object* obj_ptr; //Declare a pointer to local objectsobj_ref = …; //Initialize the reference to a distributed objectobj_ptr = bind(obj_ref); //Explicitly bind and obtain a pointer to the local proxyobj_ptr -> do_something(); //Invoke a method on the local proxy
STEM-
PNU21
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-
PNU22
Data Streaming
STEM-
PNU23
QoS : Quality of Service
Timeline, Volume and Reliability
STEM-
PNU24
Group Communication
Send to a group
Send to a machine
Send to multiple receivers
STEM-
PNU25
Group Communication : Design Issues
Closed or Open
Peer or Hierarchical Addressing
Multi-Casting or Broadcasting Uni-casting Predicate Addressing
Open to outsideClosed to outside
STEM-
PNU26
Group Communication : Design Issues
Group Membership Send/Receive Protocol
How to distinguish it from single receive Atomicity Message ordering Scalability