![A stick figure smiling](/images/welcome.jpg)
Here's a preview from my zine, Bite Size Linux!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
![Image of a comic. To read the full HTML alt text, click "read the transcript".](/images/uploads/virtual-memory.png)
read the transcript!
your computer has physical memory
memory
868 204-PIN SODIMM DDR3 CE
physical memory has addresses, like O-8GB
but when your program references an address like Ox 5c69a2a2, that’s not a physical with memory address! It’s a virtual address.
every program has its own virtual address space
program 1: Ox 129520 → “puppies”
program 2: Ox 129520 → “bananas”
Linux keeps a mapping, from virtual memory pages to physical memory pages called the page table
a “page” is a 4kb or chunk of memory (or sometimes bigger)
PID – virtual addr – physical addr
1971 – Ox 20000 – Ox 192000
2310 – Ox 20000 – Ox 228000
2310 – Ox21000 – Ox 9788000
when your program accesses a virtual address
CPU: I’m accessing Ox21000
MMU “memory management unit” (hardware): I’ll look that up in the page table and then access the right physical address
every time you switch which process is running, Linux needs to switch the page table
Linux: here’s the address of process 2950’s page table
MMU: thanks, I’ll use that now!
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!