[Tutor] I want to learn how memory works!

Alan Gauld alan.gauld at yahoo.co.uk
Sat Sep 30 02:44:27 EDT 2017


On 29/09/17 19:47, Michael C wrote:
> Could you point me to a source of information about all the things someone
> should know before he starts writing a memory scanner?  

Not a single source but wikipedia is a good start for anything technical.

In particular you need to understand the difference between
virtual(VM) and physical memory(PM). Virtual memory is the memory
that your program(process in OS speak) sees and physical memory
is the RAM installed in your computer. The OS maps virtual memory
to physical memory and depending on the OS that mapping can be
done in many ways.

In some OS (especially mainframes) you can specify in a config
file how much VM each process is given at startup, in others you
specify how much VM it needs so the OS won't allow it to start
up unless there is that much available (this is often used on
small machines and embedded systems). In others the VM is always
a theoretical space determined by the address size (or built
into the kernel).

The PM is a combination of the theoretical address space, the
installed RAM and the virtual memory page file(s). The OS swaps
memory between RAM and page file as necessary. It is quite a
complex topic and heavily OS dependent.

It looks like you are using Windows and it's too long since
I looked at that level of detail (around NT4!) to be confident
of a reply, but ~ I'd start with wikipedia for the basic
concepts then move to MSDN for the detail for your OS.

The key point is that from inside a process you are seeing a
virtualized version of memory, rarely, if ever, the actual
physical RAM addresses. Only the OS sees that.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list