Block 2: Interprocess Communications

Slides:



Advertisements
Similar presentations
DISTRIBUTED COMPUTING PARADIGMS
Advertisements

Interprocess Communication CH4. HW: Reading messages: User Agent (the user’s mail reading program) is either a client of the local file server or a client.
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Chapter 2: Communications
Interprocess Communications
Group Communications Group communication: one source process sending a message to a group of processes: Destination is a group rather than a single process.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
HOW WEB SERVER WORKS? By- PUSHPENDU MONDAL RAJAT CHAUHAN RAHUL YADAV RANJIT MEENA RAHUL TYAGI.
DISTRIBUTED COMPUTING PARADIGMS. Paradigm? A MODEL 2for notes
Chapter 4: Interprocess Communication‏ Pages
Distributed Systems Concepts and Design Chapter 4.
Interprocess Communications
Chapter 29 World Wide Web & Browsing World Wide Web (WWW) is a distributed hypermedia (hypertext & graphics) on-line repository of information that users.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 3: Communication Dr. Michael R. Lyu Computer Science & Engineering.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
Web Services. 2 Internet Collection of physically interconnected computers. Messages decomposed into packets. Packets transmitted from source to destination.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Network Architecture Protocol hierarchies Design Issues for the layers
Web Services An Introduction Copyright © Curt Hill.
Distributed Computing Paradigms1. 2 Paradigms for Distributed Applications Paradigm means “a pattern, example, or model.” In the study of any subject.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Distributed Computing, M. L. Liu 1 Interprocess Communications Mei-Ling L. Liu.
Topic 3: Remote Invocation Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
National College of Science & Information Technology.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Last Class: Introduction
WWW and HTTP King Fahd University of Petroleum & Minerals
1.2 The Network Edge Beginning at the edge of a network we are looking at the components with which we are most familiar - namely, the computers that we.
Distributed Systems.
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
Prof. Leonardo Mostarda University of Camerino
Computer Roles in a Network
CORBA Alegria Baquero.
Chapter 3 – Process Concepts
Layered Architectures
Understanding the OSI Reference Model
File Transfer and access
#01 Client/Server Computing
Client-Server Interaction
Ch > 28.4.
Computer Communication & Networks
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Multimedia and Networks
EEC-484/584 Computer Networks
CORBA Alegria Baquero.
Inter Process Communication (IPC)
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CS4470 Computer Networking Protocols
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Threads Chapter 4.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
EIDE Architecture Overview
WEB SERVICES From Chapter 19, Distributed Systems
Applications Layer Functionality & Protocols
Remote invocation (call)
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Exceptions and networking
#01 Client/Server Computing
Presentation transcript:

Block 2: Interprocess Communications Jin Sa 22-Apr-19 Client-Server Programming

Client-Server Programming Outline of block 2 Characteristics of IPC Unicast and multicast Operations in IPC Event synchronisation Synchronous and asynchronous Event diagram Deadlocks and timeout Data representation and data marshalling External representation Data marshalling and unmarshalling Text-based protocols 22-Apr-19 Client-Server Programming

Interprocess Communications The backbone of distributed computing is interprocess communications (IPC). Distributed computing requires information to be exchanged among independent processes. 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. Interprocess Communications in Unix, the Nook and Crannies by John Shapley Gray. Prentice Hall. 22-Apr-19 Client-Server Programming

Interprocess Communications in Distributed Computing 22-Apr-19 Client-Server Programming

Characteristics of IPC 22-Apr-19 Client-Server Programming

IPC – unicast and multicast 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. In this semseter, We will be mainly concerned with unicast. 22-Apr-19 Client-Server Programming

Client-Server Programming Unicast vs. Multicast 22-Apr-19 Client-Server Programming

Operations provided in Interprocess Communications API Send transmitting data to a receiving process Receive accept data from a sending process Connect establish a logical connection between two processes. The sending process issues a request for connection, the other process issues an accept connection operation Disconnect de-allocate a previously established connection at both sides 22-Apr-19 Client-Server Programming

Interprocess Communication in basic HTTP 22-Apr-19 Client-Server Programming

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. The synchronization requires system support. 22-Apr-19 Client-Server Programming

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. 22-Apr-19 Client-Server Programming

Synchronous send and receive Event diagram 22-Apr-19 Client-Server Programming

Asynchronous send and synchronous receive 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 1 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 1 The data requested by the receive operation has already arrived at the time the receive operation is issued. In this case, the data is delivered to process 2 immediately, and an acknowledgement from host 2’s IPC facility will unblock process 1. 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 2 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 2 The data requested by the receive operation has not yet arrived. Process 1 is blocked indefinitely until process 2 reissue a receive request and an acknowledgement arrives from host 2’s IPC facility. It is common to use a loop to repeatedly issue a receive operation until the awaited data is received. 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 3 22-Apr-19 Client-Server Programming

Synchronous send and async. receive - 3 The data requested by the receive operation has not yet arrived. Host 2’ IPC facility will notify process 2 when the data arrives. This scenarios requires process 2 provide a listener that can be invoked by the IPC facility to notify the process of the arrival of the data. 22-Apr-19 Client-Server Programming

Deadlocks and Timeouts 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 22-Apr-19 Client-Server Programming

Client-Server Programming Example The daytime service is the simplest network service, whereby a client process obtains a timestamp (the time of day on the server host) from the server process. Is it possible for a daytime client to be blocked indefinitely? Explain your answer. yes, if after issuing a block receive operation, server does not respond and there is no time out defined. 22-Apr-19 Client-Server Programming

Indefinite blocking due to a deadlock 22-Apr-19 Client-Server Programming

Client-Server Programming Event diagram Event diagram can be used to document the detailed sequence of events and blocking during the of a protocol. The execution of each process with respect to time is represented using a vertical line. A solid line interval represents a period that the process is active. A broken line interval represents the process is blocked. 22-Apr-19 Client-Server Programming

In class exercises Question1 Q1:Process A sends a single message to process B using connectionless IPC. To do so, A issues a send operation (specifying the message as argument) sometime during its execution, and B issues a receive operation. Suppose the send operation is blocking and the receive operation is non-blocking. Draw an event diagram for each of the following scenario: 22-Apr-19 Client-Server Programming

In class exercises Question 1 cont. Process A issues its send operation prior to process B issues its receive operation. Process B issues its receive operation prior to process A issues its send operation. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 1 answer The data requested by the receive operation has already arrived, the data is delivered to process B and an acknowledgement from host 2’s IPC facility will unblock process A subsequently. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 1 answer The data requested by the receive operation has not yet arrived, no data is delivered to the process. It is the receiving process’ responsibility to ascertain that it has indeed received the data and, if necessary, repeat the receive operation until the data has arrived. Process 1 is blocked indefinitely until process 2 reissues a receive request and an acknowledgement eventually arrives from host 2’s IPC facility. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 1 answer The data requested by the receive operation has not yet arrived. The IPC facility of host 2 will notify process 2 when the data it requested has arrived, at which point process 2 may proceed to process the data. This scenario requires that process 2 provides a listener or event handler which can be invoked by the IPC facility to notify the process of the arrival of the requested data. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 2 Q2: Repeat the last question. This time both operations (send, receive) are blocking. Process A issues its send operation prior to process B issues its receive operation Process B issues its receive operation prior to process A issues its send operation. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 2 answer 22-Apr-19 Client-Server Programming

Client-Server Programming Question 2 answer 22-Apr-19 Client-Server Programming

Client-Server Programming Question 3 Three processes P1, P2, P3 are engaged in interprocess At time 1, P3 issues a receive from P2. At time 2, P1 sends m1 to P2. At time 3, P2 issues a receive from P1. At time 4, P2 receives m1. At time 5, P2 sends message m1 to P3. At time 6, P3 receives m1; P1 issues receive from P2. At time 7, P2 issues a receive from P3. At time 8, P3 sends m2 to P2. At time 9, P2 receives m2. At time 10, P2 sends m2 to P1. At time 11, P1 receives m2. Draw a time event diagram for P1, P2 and P3 to show the sequence of events. All operations are blocking. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 3 answer 22-Apr-19 Client-Server Programming

Client-Server Programming Notes In a system environment such as Java, which supports multithreading, the blocking receive has no disadvantages as it can issue a separate thread to handle the blocking receive, and the other threads remain active. Non-blocking receive appears to be more efficient, but it requires extra complexity in the receiving process. Many today’s systems do not generally provide the non-blocking receive operation. 22-Apr-19 Client-Server Programming

Data Representation and Data Marshalling 22-Apr-19 Client-Server Programming

External data representation and marshalling Information stored in a running program is represented as data structures. Data transmitted on the network is sequence of bytes. Therefore data structures must be flattened, i.e. convert to sequence of bytes. Before transmission and rebuilt on arrival. 22-Apr-19 Client-Server Programming

External data representation and marshalling Different computers may store primitive values in different formats. To enable any two computers to exchange binary values (e.g. to support RPC): The values are converted to an agreed external format before transmission and converted to the local form on arrival The values are sent in the sender’s format, and receiver converts the value is necessary. External representation: an agreed standard for the representation of data structures and primitive values. 22-Apr-19 Client-Server Programming

External data representation and marshalling Marshalling is the process of taking a collection of data items and put them into a form suitable for transmission in a message. Unmarshalling is the process of disassembling them on arrival to produce an equivalent collection of data items at the destination. Marshalling consists of the translation of structured data items and primitive values into an external data representation. Unmarshalling consists of the generation of primitive values from their external data representation and the rebuild of the data structure. 22-Apr-19 Client-Server Programming

Examples of external data representation CORBA’s common data representation Java’s object serialization XML a text-based markup language that is fast becoming the standard for data interchange on the Web. 22-Apr-19 Client-Server Programming

Client-Server Programming Sample XML file XML has syntax similar to HTML. Unlike HTML, XML tags tell you what the data means Example: <message> <to>you@yourAddress.com</to> <from>me@myAddress.com</from> <subject> What is XML </subject> <text> XML is … </text> </message> Middleware to map to local machine’s representation. 22-Apr-19 Client-Server Programming

Client-server communication The IPC form of communication is designed to support roles and message exchanges in typical client-server interaction, where there is a request-reply communication. 22-Apr-19 Client-Server Programming

Client-Server Programming 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. 22-Apr-19 Client-Server Programming

Request-reply protocols An important type of protocol is request-reply protocol One side issues a request and awaits a response from the other side. The protocl proceeds in an iteration of request-response until the task is complete. Popular network protocols, including FTP (File Transfer Protocol) and HTTP, are request-response protocols. 22-Apr-19 Client-Server Programming

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. 22-Apr-19 Client-Server Programming

Client-Server Programming HTTP session In its basic form, HTTP is a text-based, request-response protocol that calls for only one round of exchange of messages. A web server process constantly listens for incoming request. A web browser process makes a connection to the web server process, then issues a request. The server processes the request and dispatches a response include the document requested by the browser. The browser process then parses the response and displays the document. 22-Apr-19 Client-Server Programming

Client-Server Programming Question 4 In the context of IPC, what is meant by data marshaling? (There are two components to data marshalling; name and describe each.) Why is it necessary? Answer: The two components of data marshaling are: Data structures used in programming need to be flattened or serialized, since data transmitted over the network must be serialized. The data needs to be converted to an external representation so that it may be interpreted correctly by the receiver, which then maps the external representation to its local representation. 22-Apr-19 Client-Server Programming

Client-Server Programming Review questions On completion of block 2, you should be able to Know the operations in IPC understand event synchronisation draw event diagrams to illustrate the events understand the concept of deadlock and timeout understand data marshalling 22-Apr-19 Client-Server Programming