1 Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001.

Slides:



Advertisements
Similar presentations
Heterogeneity Applies to all of the following:
Advertisements

INTERPROCESS COMMUNICATION
INTERPROCESS COMMUNICATION
Exercises for Chapter 4: Interprocess Communication
Inter Process Commonication
Network Programming Chapter 11 Lecture 6. Networks.
Chapter 2: Communications
2: Application Layer 1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
Socket Programming.
User Datagram Protocol. Introduction UDP is a connectionless transport protocol, i.e. it doesn't guarantee either packet delivery or that packets arrive.
1 Java Networking – Part I CS , Spring 2008/9.
Internetworking (Contd) Chapter 4. Figure 3.26 ATM protocol layers.
1 Overview r Socket programming with TCP r Socket programming with UDP r Building a Web server.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
OCT Information System Management 1 Organizational Communications and Distributed Object Technologies Week 5: Inter-process Communications.
CS Distributed Computing Systems Chapter 4: Interprocess Communication Chin-Chih Chang, From Coulouris, Dollimore and Kindberg.
Chapter 5: Distributed objects and remote invocation
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
OCT -- OCT Chapter 4 Coulouris Interprocess Communication.
Slides for Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Process-to-Process Delivery:
1 Inter-Process Communication: Network Programming using TCP Java Sockets Rajkumar Buyya Grid Computing and Distributed Systems (GRIDS) Laboratory Dept.
Building an ftp client and server using sockets we now know enough to build a sophisticated client/server application!  ftp  telnet  smtp  http.
Babak Esfandiari (based on slides by Qusay Mahmoud)
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 3 Inter-process Communication.
1 Tuesday, December 16, 2008 The practical scientist is trying to solve tomorrow's problem on yesterday's computer. Computer scientists often have it the.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
2: Application Layer1 Socket programming Socket API r introduced in BSD4.1 UNIX, 1981 r explicitly created, used, released by apps r client/server paradigm.
1 Tuesday, December 23, 2008 If one ox could not do the job they did not try to grow a bigger ox, but used two oxen. - Grace Murray Hopper ( )
VIII. UDP Datagrams and Sockets. The User Datagram Protocol (UDP) is an alternative protocol for sending data over IP that is very quick, but not reliable:
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Slides for Chapter 4: Interprocess Communication
Chapter 4: Interprocess Communication‏ Pages
Distributed Systems Concepts and Design Chapter 4.
Slides for Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley.
Slides for Chapter 4: Interprocess Communication
Slides for Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley.
Chapter 3: Interprocess Communication
Source: George Colouris, Jean Dollimore, Tim Kinderberg & Gordon Blair (2012). Distributed Systems: Concepts & Design (5 th Ed.). Essex: Addison-Wesley.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Interprocess.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 4: Interprocess.
1 Lecture 4: Interprocess Communication Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
1 Distribuerede systemer – 12. februar 2001 Presentation based on slides by Coulouris et al, modified by Jens B Jorgensen.
Slides for Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4, © Addison-Wesley.
6/5/2016 Slides from Distributed Computing, M. L. Liu And Distributed system design and concepts 1 Chapter 6: Group Communication.
Chapter 4: Inter-process Communications
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
Java Programming II Java Network (I) Java Programming II.
1 CSCD 330 Network Programming Fall 2013 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright Lecture 8a Application.
1 Distribuerede systemer og sikkerhed – 28. februar 2002 From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Distributed Systems Information System Management Distributed Systems Lecture 8 Chapter 4: Inter-process Communications.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 11 Omar Meqdadi Department of Computer Science and Software Engineering University.
Slides for Chapter 4: Interprocess Communication From Coulouris, Dollimore, Kindberg Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Edition 5, © Addison-Wesley 2012
Unicast VS Multicast.
Text extensions to slides © David E. Bakken,
Slides for Chapter 4: Interprocess Communication
Outline Introduction Networking Basics Understanding Ports and Sockets
سوکت (ارتباط بین کاربردها)
Text extensions to slides © David E. Bakken,
Distributed Objects: Communication and System Support
Inter-process Communication Models
Distributed Objects: Communication and System Support
Slides for Chapter 4: Interprocess Communication
Remote invocation (call)
Chapter 2: Application layer
Review Communication via paired sockets, one local and one remote
Presentation transcript:

1 Chapter 4: Interprocess Communication From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001 Presentation based on slides by Coulouris et al; modified by Jens B Jorgensen and Jonas Thomsen, University of Aarhus

2 Interprocess communication – middleware layers

3 Interprocess communication – basics zMessage passing by send and receive. zMessages put in and taken from queues. zIssues: yReliability xValidity (all messages are delivered despite a ‘reasonable’ number of packets are lost) xIntegrity (uncorrupted, without duplication) yOrdering xRandom order / sender order zCommunication patterns: ySynchronous. yAsynchronous.

4 Interprocess communication – Communication patterns zSynchronous ySend is blocking yReceive is blocking zAsynchronous ySend is non-blocking yReceive can be both blocking and non-blocking xUsually blocking – compensate by using threads Simple and non-complex code xNon-blocking more efficient Involves extra complexity to deal with

5 Interprocess communication – ports and sockets message agreed port any port socket Internet address = Internet address = other ports client server zPort: Message destination within a computer (process) zSocket: Endpoint for communication between processes yAssociated with either UDP or TCP yProcess may use any number of sockets yCan’t be shared between processes

6 UDP – User Datagram Protocol zNo acknowledgements, no retries. zNon-blocking send operation. zBlocking receive operation. zTimeouts may be applied yServer: Receive blocks for ever yClient: Timeout on receive (value difficult, fairly large) zFailure model: yOmission failures (dropped: checksum / no buffer). yOrdering (out of order deliveries). zExample of use: DNS.

7 UDP – Java API zDatagramPacket: yArray of bytes containing message. yLength of message. yInternet address. yPort number. yMethods: new, getData, getLength, getPort, getAddress. zDatagramSocket: yMethods: new, send, receive, …

8 UDP – Java client import java.net.*; import java.io.*; public class UDPClient{ public static void main(String args[]){ // args give message contents and server hostname try { DatagramSocket aSocket = new DatagramSocket(); byte [] m = args[0].getBytes(); InetAddress aHost = InetAddress.getByName(args[1]); int serverPort = 6789; DatagramPacket request = new DatagramPacket(m, args[0].length(), aHost, serverPort); aSocket.send(request); byte[] buffer = new byte[1000]; DatagramPacket reply = new DatagramPacket(buffer, buffer.length); aSocket.receive(reply); System.out.println("Reply: " + new String(reply.getData())); aSocket.close(); }catch (SocketException e){System.out.println("Socket: " + e.getMessage()); }catch (IOException e){System.out.println("IO: " + e.getMessage());} }

9 UDP – Java server import java.net.*; import java.io.*; public class UDPServer{ public static void main(String args[]){ try{ DatagramSocket aSocket = new DatagramSocket(6789); byte[] buffer = new byte[1000]; while(true){ DatagramPacket request = new DatagramPacket(buffer, buffer.length); aSocket.receive(request); DatagramPacket reply = new DatagramPacket(request.getData(), request.getLength(), request.getAddress(), request.getPort()); aSocket.send(reply); } }catch (SocketException e){System.out.println("Socket: " + e.getMessage()); }catch (IOException e) {System.out.println("IO: " + e.getMessage());} }

10 TCP – Transmission Control Protocol zTwo-way stream of bytes. zTCP uses: yconnect operation. yaccept operations. zClient creates a stream socket bound to any port and makes a connect. zServer creates a listening socket bound to a server port. zUpon accept, a connection between client and server established using a new socket yAllows peer communication

11 TCP – properties zTCP hides: yMessage sizes (splits stream into messages). yLost messages (retransmits non-acknowledge messages). yFlow control (blocks sender if receiver can’t keep up). yMessage duplication and ordering. yMessage destinations (connected – no addressing). zFailure model: yEnsures (almost always) integrity. yNot reliability: Cannot survive all situations. yUnable to distinguish network and process failures. zExamples of use: HTTP, FTP, Telnet, SMTP.

12 External data representation and marshalling – basics zPrograms use data structures; messages are sequences of bytes. zConvert by marshalling / unmarshalling. zIssues: yCharacter sets – ASCII (1 byte) vs. Unicode (2 bytes). yByte order – big-endian vs. little-endian. zTwo methods for data exchange: yConvert values to agreed external format before transmission. yTransmit values in sender’s format. zExternal data representation: Agreed standard for representation of data structures and primitive values.

13 External data representation and marshalling – approaches zCORBA’s common data representation (CDR): yRepresentation of data types used as arguments and return values in remote invocations in CORBA. y15 primitive types (short, long, char, boolean, …). yComposed types. zJava’s object serialization. yBoth objects and primitive data values may be passed as arguments and results of method invocation. zMarshalling and unmarshalling by middleware; no involvement of application programmer.

14 External data representation and marshalling – CORBA CDR message The flattened form represents aPerson struct with value: {‘Smith’, ‘London’, 1934} 0–3 4–7 8–11 12–15 16– –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 Marshalling operations can be generated automatically from the spec of the types of data items to be transmitted; types described by CORBA IDL (interface definition language).

15 Request-reply protocol – client-server communication Request ServerClient doOperation (wait) (continuation) Reply message getRequest execute method message select object sendReply zSynchronous yClient blocks until reply zBuilds on UPD send and receive

16 Request-reply protocol – operations public byte[] doOperation (RemoteObjectRef o, int methodId, byte[] arguments) sends a request message to the remote object and returns the reply. The arguments specify the remote object, the method to be invoked and the arguments of that method. public byte[] getRequest (); acquires a client request via the server port. public void sendReply (byte[] reply, InetAddress clientHost, int clientPort); sends the reply message reply to the client at its Internet address and port.

17 Request-reply protocol – message structure messageType requestId objectReference methodId arguments int (0=Request, 1= Reply) int RemoteObjectRef int or Method array of bytes

18 Request-reply protocol – failure model zProblems: yOmission failures. yNo guarantee of delivery in order. zSolutions: yTimeouts. yDiscarding duplicate request messages. yLost reply messages. yHistory. yIdempotent operations.

19 Group communication – basics zSending of a single message from one process to each of the members of a group of processes. zUseful for: yFault tolerance based on replicated services. yFinding the discovery servers in spontaneous networking. yBetter performance through replicated data. yPropagation of event notification.

20 Group communication – IP multicast zBuilt on top of IP. zAllows transmission of a single IP packet to a set of computers (a multicast group; class D internet address). zAt the application level, IP multicast is available only via UDP. zFailure model: Unreliable.

21 Group communication – IP multicast Java API zMulticastSocket (subclass of DatagramSocket). zAdding capability to join and leave multicast groups.

22 Group communication – IP multicast peers (1) import java.net.*; import java.io.*; public class MulticastPeer{ public static void main(String args[]){ // args give message contents & destination multicast group (e.g. " ") try { InetAddress group = InetAddress.getByName(args[1]); MulticastSocket s = new MulticastSocket(6789); s.joinGroup(group); byte [] m = args[0].getBytes(); DatagramPacket messageOut = new DatagramPacket(m, m.length, group, 6789); s.send(messageOut); // this figure continued on the next slide

23 Group communication – IP multicast peers (2) // get messages from others in group byte[] buffer = new byte[1000]; for(int i=0; i< 3; i++) { DatagramPacket messageIn = new DatagramPacket(buffer, buffer.length); s.receive(messageIn); System.out.println("Received:" + new String(messageIn.getData())); } s.leaveGroup(group); }catch (SocketException e){System.out.println("Socket: " + e.getMessage()); }catch (IOException e){System.out.println("IO: " + e.getMessage());} }

24 Summary zIntro to interprocess communication, incl. ports and sockets. zUDP and TCP. zExternal data representation, marshalling; CORBA CDR, Java object serialization. zRequest-reply protocol. zGroup communication.