Inter process communication in Operating System

Inter process communication where we saw that shared memory systems and message-passing systems were two ways in which inter-process communication can take place so in this lecture we’ll be seeing in a more detailed way about shared memory systems and we will see what are its features and how it actually works.
So here we have a diagram of the shared memory system which is the same kind of diagram that we saw in the previous lecture so here we have processed a and process B which wants to communicate to each other that means the inter-process communication has to take place and in order to do that the shared memory system has to be used so here a region of shared memory is established and using this region of shared memory process a and process B will communicate to each other so that means to process a will write whatever it needs to communicate to process me to this shared memory region and process B will read from this shared memory region whatever process a has written and whatever process a wanted to communicate to process B.
Inter process communication using shared memory requires communicating processes to establish a region of shared memory so that is what I just told you over here whenever process a and process B or whenever two or more processes wants to communicate to each other using the shared memory system they need to establish a region of shared memory like the one shown in this figure so that using this shared memory they can communicate with each other so this region is shared between process a and B so that whatever process a puts here B can read from here and whatever B puts here I can also read from here and then typically a shared memory region resides in the address space of the process creating the shared memory segment.
So we may think that where does this shared memory region actually reside or where does it light so the answer to that is the shared memory region resides in the address space of the process creating the shared memories segment so in this example we have process a which wants to communicate to process be so process a will create the shared memory region and it will lie in the address space of process a this shared memory region will lie in the address space of process a that means the process is the one who wants to initiate the communication.
So the shared memory region will be created in the address space of the process creating the shape memory segment so the shared memory segment is created hereby process a so the shared memory region it lies in the address space of process a so that is what we mean by this point so moving on other processes that wish to communicate using this shared memory segment.
Attach it to their address space so what is the other process that wants to communicate here it is process B so if process B wants to communicate then what it has to do is it has to attach the region of shared memory that was created by process a to its own address space that means the shared memory region is created by process a which will initiate the communication and process B must also attach this region of shared memory to its address space so that we can say that this region is shared between process a and process B so that is what we mean by this third point so normally the operating system tries to prevent one process from accessing another processes memory.

Leave a Comment