When talking about a process’ memory, I heard about things like code memory and data memory.
And for the data memory, there are 2 major managing mechanisms, stack and heap.
I am now wondering how is the code memory managed? And who manages it?
Pardon me if my statement is not so clear.
Thanks.
I recommend http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory (and the other memory related articles) if you’re interested in finding out more about the details of process’ memory management.
code memory = Text segment
Notice how the address space is 4GB. When the kernel creates a process it gives it virtual memory. Below is an example of a 32 bit OS. The kernel manages what addresses get mapped to actual RAM via the processor’s MMU. So, the kernel and the MMU manage code memory, just as they manage the entire address space of a process.
(source: duartes.org)