Hi Riya, On Mon, Jan 12, 2015 at 2:08 AM, riya khanna <riyakhanna1983@xxxxxxxxx> wrote: > Hi, > > Is there a way, w.r.t memory contents, to make a process B see what > process A sees through shared memory mappings? > > Suppose Process A has mapped a device file (say F) at address > 0xaaaaaaaa in its address space. Is it possible for process B to see > the same device file F contents as process A via shared memory > mappings? If mapped in process B's address space, would process B > continue to to see the old contents if process A were to map a new > device file (say N) at the same address 0xaaaaaaaa in its address > space or do they have independent mappings? It depends on the driver mapping that specific memory address. If it so chooses that every process trying to map that address needs to have an independent page then it'll do that. But normally if the driver allows mmapping device then it'll be a separate copy. > > So basically I'm trying to understand if there could be virtual to > virtual mappings (e.g. process B mapping process A's memory, so that B > sees whatever A sees)? This means you are getting two separate pages when you mmap the device? Normally your driver won't give you same page since once a page is mapped simple writes(like assignments etc) won't trigger any fault which might give the driver a chance to do proper locking semantics when both processes are writing at same time using just an assignment. What you can do is create a shared mapping between the two processes A and B then fill that mapping from whoever wins the race to update this shared mapping between them. You can add some information if the information needs to be updated again in this shared region between A and B. Can you tell more about your problem? > > Thanks for your help! > > -Riya > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -- ---P.K.S _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies