Interprocess communication (IPC) IN O.S

HussainAlaaAlkabi 4,505 views 21 slides Mar 08, 2018
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

nterprocess communication (IPC) is a set of programming interfaces that allow a programmer to coordinate activities among different program processes that can run concurrently in an operating system. This allows a program to handle many user requests at the same time. Since even a single user reques...


Slide Content

Inter-Process
Communication
(IPC(
Imam reza international university

2
Inter-Process Communication (IPC(

By
Hussain Kabi
Mohammed Rekabe

3
Headlines
ICP
Approaches IPC
Massage Passing
PIPES
Named pipes

4
HUSSAIN AL-KABI
MOHAMMED AL-REKABE
Inter-Process Communication (IPC(
is a set of programming interfaces that allow a programmer to
coordinate activities among different program processes that
can run concurrently in an operating system. This allows a
program to handle many user requests at the same time. Since
even a single user request may result in multiple processes
running in the operating system on the user's behalf, the
processes need to communicate with each other. The IPC
interfaces make this possible. Each IPC method has its own
advantages and limitations so it is not unusual for a single
program to use all of the IPC methods.

5
Approaches IPC

6
Approaches IPC
•File : A record stored on disk, or a record synthesized
on demand by a file server, which can be accessed by
multiple processes.
•Socket : A data stream sent over a network interface,
either to a different process on the same computer or to
another computer on the network. Typically byte-oriented,
sockets rarely preserve message boundaries. Data written
through a socket requires formatting to preserve message
boundaries.

7
Approaches IPC
• Pipe : A unidirectional data channel. Data written to the
write end of the pipe is buffered by the operating system until it
is read from the read end of the pipe. Two-way data streams
between processes can be achieved by creating two pipes
utilizing standard input and output.
•Shared Memory : Multiple processes are given access to
the same block of memory which creates a shared buffer for
the processes to communicate with each other.

8
Approaches IPC
•Massage Passing : Allows multiple programs to
communicate using message queues and/or non-OS
managed channels, commonly used in concurrency models.
•Massage queue : A data stream similar to a socket, but
which usually preserves message boundaries. Typically
implemented by the operating system, they allow multiple
processes to read and write to the message queue without
being directly connected to each other.

9
Message passing
Message Passing provides a mechanism for processes
to communicate and to synchronize their actions without
sharing the same address space
IPC facility provides two operations:
• send (message)
•Receive (massage)

10
Basic Message-passing Primitives
A. Frank - P. Weisberg

11
Connection
•Connection oriented
1. open Connection(address) Tests whether receiver exists and
whether he/she wants a connection with the caller Connection
2. send(message)
3.receive(message)
4.Close Connection

Empties message buffer and deletes connection

12
Connection (2(
•Connectionless

•Send (target_address, message)
•Receive (source address, message)
•Target is often a server
•Source is often a client

13
Connection (3(
CLIENT SERVER
Operation
Get request
Select object
Execute
Send reply
continuation
*
Wait
*

14
Message format
•Consists of header and
body of message.
•In Unix: no ID, only
message type.
•Control info:
–what to do if run out of
buffer space.
–sequence numbers.
–priority.
•Queuing discipline: usually
FIFO but can also include
priorities.

15
Pipelines
pipeline is a sequence of processes chained together
by their standard streams, so that the output of each
process feeds directly as input to the next one

16
•linear pipelines processor is a series of processing stages and
memory access.
•Non-linear pipelines (also called dynamic pipeline) can be
configured to perform various functions at different times.
In a dynamic pipeline, there is also feed-forward or feed-
back connection. A non-linear pipeline also allows very
long instruction words.
Pipelines categories

17
Named pipe
Also known as a FIFO for its behavior is an extension to the
traditional pipe concept on Unix and Unix-like systems, and
is one of the methods of inter-process communication (IPC).
FIFO : First input First output

18
Named pipe
Named Pipes are more powerful than ordinary pipes.
•Communication is bidirectional.
•No parent-child relationship is necessary between the
communicating processes.
•Several processes can use the named pipe for
communication.

19
A. Frank - P. Weisberg
Messages and Pipes Compared

20
Reference
•Teng Wang; Kevin Vasko; Zhuo Liu; Hui Chen; Weikuan Yu (2016). "Enhance parallel
input/output with cross-bundle aggregation". The International Journal of High Performance
Computing Applications. 30
• Michael J. (2004). Parallel Programming in C with MPI and openMP. Dubuque, Iowa: McGraw-
Hill Professional. ISBN 0072822562
• "mknod". www.opengroup.org.
•www.wikipida .com

21
Thank you