Inter Process Communication

5,985 views 20 slides Jul 21, 2018
Slide 1
Slide 1 of 20
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

About This Presentation

On these slides i describe all the detail about Inter Process Communication.


Slide Content

Inter-Process Communication

Adeel Rasheed For More Slides Visit: https://www.slideshare.net/adeel02

Independent Processes:  O perating concurrently on a systems are those that can neither affect other processes or be affected by other processes . Cooperating Processes:   A re those that can affect or be affected by other processes . IPC

Mechanism for allows processes to communicate and to synchronize their actions. 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 subtask. Convenience :    An individual user can run several programs at the same time, to perform some task. Why We Use IPC

Shared Memory systems. Message Passing systems . Types/Ways of IPC

Shared Memory A llows multiple processes to share virtual memory space. F astest but not necessarily the easiest (synchronization-wise) way for processes to communicate with one another. Process A Process B 0x30000 0x50000 0x50000 0x70000 Shared memory region

Shared Memory

There are two processes: Producer and Consumer . Producer produces some item and Consumer consumes that item. The two processes shares a common space or memory location known as buffer where the item produced by Producer is stored and from where the Consumer consumes the item if needed. Producer-Consumer problem 

There are two version of this problem: first one is known as unbounded buffer problem in which Producer can keep on producing items and there is no limit on size of buffer, the second one is known as bounded buffer problem in which producer can produce up to a certain amount of item and after that it starts waiting for consumer to consume it. The pseudo code are given below: Unbounded Buffer Problem

We will discuss the bounded buffer problem. First, the Producer and the Consumer will share some common memory, then producer will start producing items. If the total produced item is equal to the size of 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. B ounded Buffer Problem

In a Message passing system there are no shared variables. IPC facility provides two operations for fixed or variable sized message: send(message) receive(message) If processes P and Q wish to communicate, they need to: establish a communication link exchange messages via send and receive Message-Passing Systems

There are key issues to be resolved in message passing systems as further explored in the next subsections: Direct or indirect communication ( naming ) Synchronous or asynchronous communication Key Issues

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. S ymmetric   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. Direct Communication

Indirect communication  uses shared mailboxes, or ports . Multiple processes can share the same mailbox or boxes. Only one process can read any given message in a mailbox. Initially the process that creates the mailbox is the owner, and is the only one allowed to read mail in the mailbox, although this privilege may be transferred. The OS must provide system calls to create and delete mailboxes, and to send and receive messages to/from mailboxes. Indirect communication  

synchronous messaging involves a client that waits for the server to respond to a message. Messages are able to flow in both directions, to and from . Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server. So even if the client is down, the messaging will complete successfully. Asynchronous Messaging means that, it is a one way communication and the flow of communication is one way only. Synchronous or asynchronous communication