Part5 PDF
Part5 PDF
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
Interprocess Communications in
Distributed Computing
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.
blocking
send
starts
blocking
send
returns
Transparent
acknowledgment
provided by the
IPC facility
Execution flow
blocking
receive
ends
An operation
Suspended period
10
nonblocking
send
issued
blocking
receive
ends
Execution flow
Suspended period
An operation
11
blocking
send
issued
blocking
send
returns
Scenario 1
non-blocking
receive
issued
Transparent
acknowledgment
provided by the
IPC facility
Execution flow
An operation
Suspended period
12
Scenario 2
blocking
send
issued
indefinite
blocking
Execution flow
An operation
Suspended period
13
Scenario 3
blocking
send
issued
Transparent
acknowledgment
provided by the
IPC facility
Execution flow
process is
notified of the
arrival of data
An operation
Suspended period
14
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
17
thread is blocked
18
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
22