User: Password:
Subscribe / Log in / New account

Memory part 3: Virtual Memory

Memory part 3: Virtual Memory

Posted Oct 11, 2007 23:32 UTC (Thu) by jzbiciak (subscriber, #5246)
In reply to: Memory part 3: Virtual Memory by addw
Parent article: Memory part 3: Virtual Memory

If it were, then it seems virtual memory is a recipe for wasting half your memory. I think what was meant was "each contiguous range that is mapped."

There seems to be a shorthand amongst some folk to call what corresponds to a row in /proc/<PID>/maps "a mapping," when indeed it is typically composed of multiple pages, and is really multiple mappings that are contiguous in virtual address space. For example, a quick peek with "cat /proc/self/maps" here at work shows:

$ cat /proc/self/maps 
00101000-00227000 r-xp 00000000 03:02 1196106    /lib/tls/
00227000-00229000 r-xp 00125000 03:02 1196106    /lib/tls/
00229000-0022b000 rwxp 00127000 03:02 1196106    /lib/tls/
0022b000-0022d000 rwxp 0022b000 00:00 0 
0055c000-00572000 r-xp 00000000 03:02 1196104    /lib/
00572000-00573000 r-xp 00015000 03:02 1196104    /lib/
00573000-00574000 rwxp 00016000 03:02 1196104    /lib/
08048000-0804c000 r-xp 00000000 03:02 967851     /bin/cat
0804c000-0804d000 rwxp 00003000 03:02 967851     /bin/cat
0804d000-0806e000 rwxp 0804d000 00:00 0 
b7fde000-b7fe0000 rwxp b7fde000 00:00 0 
bfffd000-c0000000 rwxp bfffd000 00:00 0 
ffffe000-fffff000 ---p 00000000 00:00 0 

Under the shorthand nomenclature, that's 13 mappings. Clearly, far more than 13 pages are involved.

(Log in to post comments)

definition of mapping

Posted Oct 12, 2007 17:07 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

It's not even shorthand; it's just the nonspecific meaning of the word "mapping." Relating 10 virtual pages to 10 real pages is a mapping; relating one of those real pages to one of those real pages is also a mapping. One could legitimately call an entire page table a mapping.

The text elides a great deal about the process of loading an executable; if it gave proper context, it would probably be more clear that it isn't referring to individual page mappings.

definition of mapping

Posted Oct 12, 2007 17:17 UTC (Fri) by jzbiciak (subscriber, #5246) [Link]

Fair enough. I try to be precise myself when I can. I personally think of the three notions of "mapping" you have as "page mapping," "mapped range" and "memory map", though I can easily see imperfections in those names. :-)

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds