VM and Pagetables
I’ve been learning about virtual memory. I guess I’ll explain what I know, and if someone wants to correct me, please let me know.<p/>
Okay, so, fundamentally, VM is a mapping of virtual pages to “other things” (like physical memory, devices, disks, etc.) What’s a page? 4k of memory. Well, it’s not always 4k, but that’s a common size. The size dictates how many entries in the page table you have, because each page can be mapped to something different and it has to keep track of each page individually.<p/>
What’s the point of VM? There are many. Processes shouldn’t be able to access the memory of other processes, and in this method each process gets its own VM address space so that you can’t possibly confuse them. Also, these mappings can go to many places – you can have two processes share the same address space; you can swap pages to disk and then bring them back when somebody needs to use them; you can (as mentioned before) make some pages actually devices like graphics memory, and so forth.<p/>