The document discusses inter-process communication (IPC), which allows concurrent processes within an operating system to communicate and coordinate activities. Various IPC methods are covered, including file, socket, pipe, shared memory, and message passing, each with distinct advantages and limitations. The document also explains message formatting, connection types, and the concept of named pipes in relation to traditional pipes.
4 HUSSAIN AL-KABI
MOHAMMEDAL-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.
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.
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.
8
Approaches IPC
• MassagePassing : 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.
9
Message passing
Message Passingprovides 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)
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.
12
Connection (2(
• Connectionless
•Send (target_address, message)
• Receive (source address, message)
• Target is often a server
• Source is often a client
14
Message format
• Consistsof 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.
15
Pipelines
pipeline is asequence of processes chained together
by their standard streams, so that the output of each
process feeds directly as input to the next one
16.
16
• linear pipelinesprocessor 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.
17
Named pipe
Also knownas 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.
18
Named pipe
Named Pipesare 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.
19 A. Frank- P. Weisberg
Messages and Pipes Compared
20.
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