Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Computing, M. L. Liu 1 Interprocess Communications Mei-Ling L. Liu.

Similar presentations


Presentation on theme: "Distributed Computing, M. L. Liu 1 Interprocess Communications Mei-Ling L. Liu."— Presentation transcript:

1 Distributed Computing, M. L. Liu 1 Interprocess Communications Mei-Ling L. Liu

2 Distributed Computing, M. L. Liu 2 Interprocess Communications - Operating systems provide facilities for interprocess communications (IPC), such as message queues, semaphores, and shared memory. - Distributed computing systems make use of these facilities to provide application programming interface which allows IPC to be programmed at a higher level of abstraction. - Distributed computing requires information to be exchanged among independent processes.

3 Distributed Computing, M. L. Liu 3 IPC – unicast and multicast In distributed computing, two or more processes engage in IPC in a protocol agreed upon by the processes. A process may be a sender at some points during a protocol, a receiver at other points. When communication is from one process to a single other process, the IPC is said to be a unicast. When communication is from one process to a group of processes, the IPC is said to be a multicast, a topic that we will explore in a later chapter.

4 Distributed Computing, M. L. Liu 4 Unicast vs. Multicast

5 Distributed Computing, M. L. Liu 5 Interprocess Communications in Distributed Computing

6 Distributed Computing, M. L. Liu 6 Operations provided in an archetypal Interprocess Communications API Receive ( [sender], message storage object) Connect (sender address, receiver address), for connection-oriented communication. Send ( [receiver], message) Disconnect (connection identifier), for connection- oriented communication.

7 Distributed Computing, M. L. Liu 7 Interprocess Communication in basic HTTP

8 Distributed Computing, M. L. Liu 8 Event Synchronization Interprocess communication requires that the two processes synchronize their operations: one side sends, then the other receives until all data has been sent and received. Ideally, the send operation starts before the receive operation commences. In practice, the synchronization requires system support.

9 Distributed Computing, M. L. Liu 9 Synchronous vs. Asynchronous Communication The IPC operations may provide the synchronization necessary using blocking. A blocking operation issued by a process will block further processing of the process until the operation is fulfilled. Alternatively, IPC operations may be asynchronous or nonblocking. An asynchronous operation issued by a process will not block further processing of the process. Instead, the process is free to proceed with its processing, and may optionally be notified by the system when the operation is fulfilled.

10 Distributed Computing, M. L. Liu 10 Synchronous send and receive

11 Distributed Computing, M. L. Liu 11 Asynchronous send and synchronous receive

12 Distributed Computing, M. L. Liu 12 Synchronous send and Async. Receive - 1

13 Distributed Computing, M. L. Liu 13 Synchronous send and Async. Receive - 2

14 Distributed Computing, M. L. Liu 14 Synchronous send and Async. Receive - 3

15 Distributed Computing, M. L. Liu 15 Asynchronous send and Asynchronous receive

16 Distributed Computing, M. L. Liu 16 Event diagram

17 Distributed Computing, M. L. Liu 17 Blocking, deadlock, and timeouts Blocking operations issued in the wrong sequence can cause deadlocks. Deadlocks should be avoided. Alternatively, timeout can be used to detect deadlocks.

18 Distributed Computing, M. L. Liu 18 Using threads for asynchronous IPC When using an IPC programming interface, it is important to note whether the operations are synchronous or asynchronous. If only blocking operation is provided for send and/or receive, then it is the programmer’s responsibility to using child processes or threads if asynchronous operations are desired.

19 Distributed Computing, M. L. Liu 19 Deadlocks and Timeouts Connect and receive operations can result in indefinite blocking For example, a blocking connect request can result in the requesting process to be suspended indefinitely if the connection is unfulfilled or cannot be fulfilled, perhaps as a result of a breakdown in the network. It is generally unacceptable for a requesting process to “hang” indefinitely. Indefinite blocking can be avoided by using timeout. Indefinite blocking may also be caused by a deadlock

20 Distributed Computing, M. L. Liu 20 Indefinite blocking due to a deadlock

21 Distributed Computing, M. L. Liu 21 Data Representation Data transmitted on the network is a binary stream. An interprocess communication system may provide the capability to allow data representation to be imposed on the raw data. Because different computers may have different internal storage format for the same data type, an external representation of data may be necessary. Data marshalling is the process of (I) flatterning a data structure, and (ii) converting the data to an external representation. Some well known external data representation schemes are: Sun XDR ASN.1 (Abstract Syntax Notation) XML (Extensible Markup Language)

22 Distributed Computing, M. L. Liu 22 Data Encoding Protocols

23 Distributed Computing, M. L. Liu 23 Sample XML file http://java.sun.com/xml/docs/tutorial/overview/1_xml.html#intro XML is a text-based markup language that is fast becoming the standard for data interchange on the Web. XML has syntax analogus to HTML. Unlike HTML, XML tags tell you what the data means, rather than how to display it. Example: you@yourAddress.com me@myAddress.com XML Is Really Cool How many ways is XML cool? Let me count the ways...

24 Distributed Computing, M. L. Liu 24 Data Marshalling

25 Distributed Computing, M. L. Liu 25 Text-based protocols Data marshalling is at its simplest when the data exchanged is a stream of characters, or text. Exchanging data in text has the additional advantage that the data can be easily parsed in a program and displayed for human perusal. Hence it is a popular practice for protocols to exchange requests and responses in the form of character-strings. Such protocols are said to be text-based. Many popular network protocols, including FTP (File Transfer Protocol), HTTP, and SMTP (Simple Mail Transfer Protocol), are text-based.

26 Distributed Computing, M. L. Liu 26 Event diagram for a protocol session

27 Distributed Computing, M. L. Liu 27 Event Diagram for a HTTP session

28 Distributed Computing, M. L. Liu 28 Sequence Diagram

29 Distributed Computing, M. L. Liu 29 sequence diagram for a HTTP session

30 Distributed Computing, M. L. Liu 30 Protocol In a distributed application, two processes perform interprocess communication in a mutually agreed upon protocol. The specification of a protocol should include (i) the sequence of data exchange, which can be described using a time event diagram. (ii) the specification of the format of the data exchanged at each step.

31 Distributed Computing, M. L. Liu 31 HTTP: A sample protocol The Hypertext Transfer Protocol is a protocol for a process (the browser) to obtain a document from a web server process. It is a request/response protocol: a browser sends a request to a web server process, which replies with a response.

32 Distributed Computing, M. L. Liu 32 The Basic HTTP protocol

33 Distributed Computing, M. L. Liu 33 A sample HTTP session

34 Distributed Computing, M. L. Liu 34 IPC paradigms and implementations Paradigms of IPC of different levels of abstraction have evolved, with corresponding implementations.

35 Distributed Computing, M. L. Liu 35 Summary Interprocess communications (IPC) is the backbone of distributed computing. In this chapter we have looked at the principles of IPC, including the followings: What is interprocess communication? Unicast? Multicast? What is an IPC application programming interface (API) and what primitive operations does such an interface provide? Event synchronization: How do processes engaged in IPC synchronize or coordinate the send and receive operations? What role do blocking operations play in this regard?

36 Distributed Computing, M. L. Liu 36 Summary - 2 Data representation or encoding schemes: Why is data marshalling necessary? What are the two components involved in data marshalling? What are the different levels of abstraction in data encoding? What is meant by object serialization? What is the difference between connection- oriented and connectionless interprocess communications? Compare and contrast the two.

37 Distributed Computing, M. L. Liu 37 Summary - 3 What is an event diagram? How can it be used to describe the sequence of events and their synchronization in a protocol such as the HTTP? What is a sequence diagram? How can it be used to describe the sequence of events in a protocol such as the HTTP? What are the different levels of abstraction in IPC paradigms?


Download ppt "Distributed Computing, M. L. Liu 1 Interprocess Communications Mei-Ling L. Liu."

Similar presentations


Ads by Google