- On Unix systems, can I find the physical memory address for a given virtual memory address? If so, how?
The real problem I'm trying to solve is how can I find out if the OS maps two virtual addresses to the same physical region?
eg. in the smaps example smaps , how do I know if both areas of memory are physically identical?
cat /proc/<pid>/smaps ... 7f7165d42000-7f7265d42000 r--p 00000000 00:14 641846 /run/shm/test (deleted) Size: 4194304 kB Rss: 4194304 kB Pss: 2097152 kB ... VmFlags: rd mr mw me nr sd 7f7265d42000-7f7365d42000 rw-s 00000000 00:14 641846 /run/shm/test Size: 4194304 kB Rss: 4194304 kB Pss: 2097152 kB ... VmFlags: rd wr sh mr mw me ms sd ...
Bonus: is there a way to do this programmatically in C ?
I tried to look for duplicates, but could not find a suitable one.
c memory-management linux unix
quantdev
source share