Inter Process Communication
Inter Process Communication
Communication
Members Name
• Ayesha Taimoor(014)
• Javeria Bibi(001)
• Sidra Bibi(006)
• Anisa Bibi(021)
• Tanzila Javeed(005)
• Zainab Asghar(058)
3
A
Agenda
Introduction
Types/Ways of IPC
Shared Memory
Procedure-Consumer
problem
5
Approaches
Here, are few important methods for
interprocess communication:
Pipes
Message Passing
Message Queues
Direct Communication
Indirect Communication
Shared Memory
FIFO
6
Why We Use IPC
Information sharing: Several processes may need to
access the same data(such as stored in a file)
Computation speedup: A task can offer be run faster if
it is broken into subtasks and distributed among
different processes
Resource Sharing: Sharing Hardware, memory etc.
Why We Use IPC
Modularity: It may be easier to organize a complex
task into separate subtasks, then have different
processes or threads running each subtasks.
Convenience: An individual user can run several
programs at the same time, to perform some task
8
Types/Ways of IPC
• Shared Memory systems
• Message Passing systems
9
Cooperating Processes
• Independent process cannot affect or be affected by the execution of
another process
• Cooperating process can affect or be affected by the execution of another
process
• Advantages of process cooperation
• Information sharing
• Computation speed-up
• Modularity
• Convenience
10
Shared Memory
• Allows multiple processes to share virtual memory space
• Fastest but not necessarily the easiest (synchronization-wise) way for
processes to communicate with one another
Shared Memory
12
Producer-Consumer
problem
• We will discuss the bounded buffer problem. First, the Producer and
the Consumer will share some common memory, then producer will
share some common memory, then producer will start producing items
.If the total produced item is equal to the size buffer, producer will
wait to get it consumed by the consumer. Similarly, the consumer first
check for the availability of the item and if no item is available,
Consumer will wait for producer to produce it. If there are items
available, consumer will consume it.
15
Producer Consumer problem
19
Direct Communication
• With direct communication the sender must know the name of the
receiver to which it wishes to send a message. There is a one-to-one
link between every sender-receiver pair
• Symmetric communication, the receiver must also know the specific
name of the sender from which it wishes to receive messages.
• Asymmetric communications, this is not necessary
20
Indirect Communication
22
Asynchronous Communication
23
Summary