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