Download presentation
Presentation is loading. Please wait.
Published bybishal bastola Modified over 6 years ago
1
INTERPROCESS COMMUICATION By Bishal Bastola Roll no: 01 & Manbahadur Katuwal Roll no: 04
2
Contents Introduction to IPC Shared memory Message passing Race conditions Critical regions Mutual exclusions
3
Introduction to IPC It is the mechanism whereby one process can communicate or exchange data, frequently with another process. By allowing processes to communicate with each other: We can synchronize the execution of the processes relative to each other. Share important information. IPC can be performed by two methods, they are: a)Shared memory b)Message passing
4
Shared memory Shared memory is the memory which is shared between the two or more processes. By using shared memory one program will create a memory portion which other processes can access and make changes.
5
Message passing In this a sender or a source process sends a message to a known receiver or destination process. Message has a pre defined structure and message passing uses two system call: send and receive. send(message, destination) or send(message) receive(message, host) or receive(message) Message passing systems make workers communicate through a messaging system. Messages keep everyone separated, so that workers cannot modify each other's data.
6
Race Condition When two or more processes are reading or writing some shared data and the final result depends on who runs precisely when, are called race condition. For example: When process A and process B are accessing the same shared data at the same time: given value of X=50; Process AProcess B Read(X) X=X+10X=X-20 Write(X)
7
Critical region Critical regions are segments of code where shared resources are accessed by the processes To create mutual exclusion mechanisms Avoid equal access to shared resources Programs could run on both the non-critical section and critical section Operating system would allow several processes run in their non-critical section but one process at once to run at its critical section
8
Critical region cont.……..
9
Mutual exclusion Mutual exclusion is the way of ensuring that one process, while using the shared variable, does not allow another process to access that variable. Only one process is allowed to execute at a time in its critical section.
10
The End
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.