0% found this document useful (0 votes)
36 views22 pages

Part5 PDF

The document discusses interprocess communication (IPC) in distributed computing systems. It describes how IPC allows processes to exchange information and synchronize operations. There are two main types of IPC - unicast, which is communication between two processes, and multicast, which is communication between one process and multiple processes. IPC APIs provide functions like send, receive, connect and disconnect. Operations can be synchronous, blocking the sending process until the receive is complete, or asynchronous, allowing processes to continue without waiting. Proper use of synchronous and asynchronous operations is important to avoid indefinite blocking or deadlocks between processes.

Uploaded by

Tigabu Yaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views22 pages

Part5 PDF

The document discusses interprocess communication (IPC) in distributed computing systems. It describes how IPC allows processes to exchange information and synchronize operations. There are two main types of IPC - unicast, which is communication between two processes, and multicast, which is communication between one process and multiple processes. IPC APIs provide functions like send, receive, connect and disconnect. Operations can be synchronous, blocking the sending process until the receive is complete, or asynchronous, allowing processes to continue without waiting. Proper use of synchronous and asynchronous operations is important to avoid indefinite blocking or deadlocks between processes.

Uploaded by

Tigabu Yaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Distributed Internet Applications - DIA

Interprocess Communications

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.
2

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.
3

Unicast vs. Multicast

Interprocess Communications in
Distributed Computing

Operations provided in an 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.
6

Interprocess Communication in basic HTTP


Web server

S1 S2
a process

S3 S4

HTTP
request
HTTP
response

an operation
data flow

C1 C2 C3
Web browser

C4

operations:
S1: accept connection
S2: receive (request)
S3: send (response)
S3: disconnect
C1: make connection
C2: send (request)
C3: receive (response)
C4: disconnect

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.
In practice, the synchronization requires system support.

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.
9

Synchronous send and receive


Process 1 running on host 1

Process 2 running on host 2


blocking
receive
starts

blocking
send
starts

blocking
send
returns

Transparent
acknowledgment
provided by the
IPC facility

Execution flow

blocking
receive
ends

An operation

Suspended period
10

Asynchronous send and Synchronous receive


Process 1 running on host 1

Process 2 running on host 2


blocking
receive
starts

nonblocking
send
issued

blocking
receive
ends

Execution flow
Suspended period

An operation
11

Synchronous send and Asynchronous receive


Process 1 running on host 1

blocking
send
issued

blocking
send
returns

Process 2 running on host 2

Scenario 1

non-blocking
receive
issued

Transparent
acknowledgment
provided by the
IPC facility

Execution flow

An operation

Suspended period
12

Synchronous send and Asynchronous receive


Process 1 running on host 1

Process 2 running on host 2


non-blocking
receive
issued and
returned
immediately

Scenario 2
blocking
send
issued

indefinite
blocking

Execution flow

An operation

Suspended period

13

Synchronous send and Asynchronous receive


Process 1 running on host 1

Scenario 3
blocking
send
issued

Transparent
acknowledgment
provided by the
IPC facility

Execution flow

Process 2 running on host 2


non-blocking
receive
issued and
returned
immediately

process is
notified of the
arrival of data

An operation

Suspended period
14

Asynchronous send and Asynchronous receive


Process 1 running on host 1

Process 2 running on host 2


non-blocking
receive
issued and
returned
Immediately.

nonblocking
send

process is notified
ff the arrival of the
data and the data
may now be delivered
to it.

Execution flow

An operation

Suspended period
15

Event Diagram
Time

Process 1

Process 2

Interprocess communication

request 1
An operation
response 1

Process blocked

request 2

Execution flow

response 2

16

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.

17

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 programmers responsibility to using child processes or
threads if asynchronous operations are desired.
process
main thread

new thread issues a blocking IPC operation

main thread continues with


other processing

thread is blocked

thread is unblocked after the operation is fulfilled

18

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.
19

Indefinite Blocking due to a Deadlock

20

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)
21

Data Encoding Protocols

22

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy