1 / 73

3. Communication in distributed system

3. Communication in distributed system. Name,. Communication middleware. IP address port,. 3.1 Introduction. Interprocess communication is at the heart of distributed systems. Distributed Application. Low-level message passing underlying network. P69. Middleware Protocols.

zarita
Download Presentation

3. Communication in distributed system

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3. Communication in distributed system

  2. Name, ... Communication middleware IP address port, ... 3.1 Introduction Interprocess communication is at the heart of distributed systems Distributed Application Low-level message passing underlying network

  3. P69 Middleware Protocols An adapted reference model for networked communication. 2-5

  4. Distributed Middleware • Communication middleware: RPC, RMI, MPI • name DCE, CORBA • message-oriented • various communication forms • Authentication, authorization protocols • Distributed commit protocols

  5. Client-Server TCP P65 Normal operation of TCP. Transactional TCP. 2-4

  6. S T Q P Two issues for communication mechanism: • How indicate destination? • How many methods (forms)?

  7. S T Q P 1. Addressing Indicate sending and receiving processes 1) <IP address, port no.> ex, <202.119.32.6, 80> 2) Unique name ex, www.nju.edu.cn; procedure name( )

  8. Domain name IP address Type www.nju.edu.cn 202.119.32.6 A cs.nju.edu.cn 202.119.36.5 A …… …... …... www.nju.edu.cn DNS 80 21 ftp://nju.edu.cn <202.119.32.6, 21> <202.119.32.6, 80> web server FTPd 202.119.32.6

  9. sender sender receiver receiver mailbox 3) Mailbox (queue, indirect) multi-in, multi-out 2. Methods 1) Synchronous/asynchronous

  10. waiting waiting Synchronous: sender will be blocked if receiver is not ready P1 P2 send receive receive send send( ), recv( ); RPC

  11. UDP, Asynchronous RPC Asynchronous P1 P2 send receive receive send Internet?

  12. Comparison Defects merits Synchronous wait, no broadcast safe, simple Asynchronous buffer full,not safe parallelism, broadcast 2) Transient/persistent • Persistent communication: A message is stored by communication system as long as it takes to deliver it. Neither the sender nor the receiver need to be up. Ex, email P100-1

  13. Persistence in Communication P100

  14. send, recv; RPC UDP; asyn RPC email • Transient communication: A message is stored by communication system as long as the sending and receiving applications are executing Ex, send, recv in Socket Question: difference (relation) between 1) and 2) transient synchronous persistent asynchronous As to: 1) sender/receiver; 2) message

  15. 3) Stream-oriented communication Two successive messages have a temporal relationship. Ex, movie, audio stream

  16. P68 3.2 RPC P1 P2 Proc G(u,v) Call P2.G(x,y) node 1 node 2 ……….. 2003.7 Worm.msBlast

  17. i buf j sp 1. Conventional procedure call Node 1 process Procedure Q(u,box,v) { … { … Q(i,buf,j) … … } } return addr. result stack

  18. proc Q int i return addr.1 ? buf return addr 2 int j i result i buf sp buf j j sp return 2. How does RPC work? node 1node 2 process Procedure Q(u,box,v) { … { … Q(i,buf,j) … … } } result result ? stack stack

  19. Original procedure call: Now push return addr.1 push i Q(i,buf,j) push buf push j goto Q goto c_stub take result

  20. Q( ) { } • S_stub • receive message • unpack message • push return addr. • goto Q( ) • take & pack result • send it to C_stub • C_stub • pack parameters & name • send them to S_stub • receive result • unpack result • return transform

  21. P72 Steps of a Remote Procedure Call • Client procedure calls client stub in normal way • Client stub builds message, calls local OS • Client's OS sends message to remote OS • Remote OS gives message to server stub • Server stub unpacks parameters, calls server • Server does work, returns result to the stub • Server stub packs it in message, calls local OS • Server's OS sends message to client's OS • Client's OS gives message to client stub • Stub unpacks result, returns to client

  22. P74 Passing Value Parameters Steps involved in doing remote computation through RPC 2-8

  23. Issues to be handled • Machine may be not identical • Execute in different spaces • Machine may crash 3. Parameter passing Implementation should consider: • Different types of computers • Pointer or call by reference

  24. P75 1) Deal with different types of computers 5 Jill (a) Original message on the Pentium (b) The message after receipt on the SPARC (c) The message after being inverted. The little numbers in boxes indicate the address of each byte

  25. proc Q int i char buf int j How represent parameters? • In intermediate form • Indicating in type i typeitypej Message should include parameters and their type 2) Deal with call by reference

  26. B 5200 Node1Node2 Main( ) { int B[100] proc write(name,buf,len) … { int len, buf[ ]; write(f1,B,100)… … } proc read(name, buf, len) { int len, buf[ ]; read(f2,B,100) … } 5200

  27. write read

  28. proc write(in char name, in int buf[], in int len); proc read(in char name, out int buf[], in int len); • Input parameter  deliver the array • Output parameter  needn’t 4. Where stubs come from? • Write server specification (interfaces) including: Server name, version, list of procs • Stub compiler generates c_stub & s_stub

  29. Specification of file server Specification of file_server, version 3.1: long read(in char name[MAX_PATH], out char buf[BUF_SIZE], in long bytes, in long position); long write(in char name[MAX_PATH], in char buf[BUF_SIZE], in long bytes, in long position); int create(in char name[MAX_PATH], in int mode); int delete(in char name[MAX_PATH]); end; return IDL

  30. C_stub specification Stub compiler S_stub 5. Steps for using RPC • write specification • compile • write server code and link with s_stub • write client code and link with c_stub

  31. P82 The steps in writing a client and a server in DCE RPC.

  32. {…… } {…… }

  33. binder 2 1 3 client server 4 6. Dynamic binding --- How client find server 1) Register: name, version, handle(IP,port), unique id 2) Look up: name, version (first time) 3) Reply: handle, unique id 4) Request: unique id, parameters 5) Deregister: name, version, unique id

  34. Advantage: flexible • Server move won’t affect client • Binder can even load if multiple servers support the same interface • Disadvantage • Overhead at running time • Binder is bottleneck

  35. NFS FTP Telnet XDR RPC Socket/TLI TCP|UDP ICMP IP ARP Driver Addressing Method Addressing: name Method: synchronous, transient

  36. 100 A B 7. Extended RPC --- asynchronous RPC P79 (a) The interconnection between client and server in a traditional RPC (b) The interaction using asynchronous RPC

  37. A client wants to prefetch network addresses of a set of hosts A client and server interacting through two asynchronous RPCs 2-13 P80

  38. P86 3.3 RMI (or Remote Object Invocation) Common organization of a remote object with client-side proxy.

  39. 1. Distributed object RMI Compares to RPC: • Same: • the steps of call is similar • separating interface from implementation • Difference • procedure is a segment of program. • object is a variable of a data type, method is in object.

  40. distributed obj local object remote Object reference compare to pointer. System provides 2. Object references Object references are similar to pointer, but not the same. point object object reference

  41. advertise salesman cost() {… } bonus() {… } employee Object servers promote() {…} dismiss() {… } 2. personnel.hire( ) Corp server 3. personnel ? hire() {… } … P152 Sale server 1. IP address

  42. Information object reference contains P89 • network address of the machine • server id or endpoint (i.e.port number) • object id

  43. 2 1 3 4 • May use location server location server client server Server can move

  44. 3. Implementation of object references • Server id instead of server’s endpoint. A daemon listens to a well-known endpoint and knows every server. daemon server1 keep a table server2

  45. How introduce object? 4. Several remote object invocation chapter 9 1) CORBA Open, heterogeneous environment 2) DCOM Microsoft world C++ Java C func P( ) Object Object

  46. 3) Java RMI • Java environment • Distributed objects have been integrated into the language Summary Addressing: name Method: synchronous, transient

  47. P99 3.4 Message-oriented communication 1. Message-oriented transient communication 1) RPC and RMI advantages: hide communication; message-oriented disadvantage: synchronous; both need to be up 2) Recall socket P105 addressing: IP address, port forms: synchronous/asynchronous, transient shortage: low-level, byte-oriented/TCP-IP

  48. 3) MPI P107 designed for parallel applications; offer efficient communication primitives; for high-speed nets. World Jupiter Process0 Process1 Process2 Process0 Process1 Process3 Process2 Process5 Process4 communicator

  49. 100 • Addressing (groupID, processID) • Forms support most transient communication forms ? A B; email Need for various communication forms • Synchronous/asynchronous • Transient/persistent

  50. 100 Various combinations: P103 Why list so many forms? Where to use? For efficiency. (a) email (c) A B (e) send recv (f) RPC (persistent, asynchronous) (transient, asynchronous) (transient, synchronous) (transient, synchronous/asyn)

More Related