Process memory layout

A process is an instance of a program in execution. It is seen as a live, runtime schedulable entity by the OS. In other words, it's the process that runs when we launch a program.

The OS, or kernel, stores metadata about the process in a data structure in kernel memory; on Linux, this structure is often called the process descriptor—though the term task structure is a more accurate one. Process attributes are stored in the task structure; the process PID (process identifier) – a unique integer identifying the process, process credentials, open-file information, signaling information, and a whole lot more, reside here.

From the earlier discussion, Virtual memory, we understand that a process has, among many other attributes, a VAS. The VAS is the sum-total space potentially available to it. As in our earlier example, with a fictional computer with 16 address lines, the VAS per process would be 2^16 = 64 KB.

Now, let's consider a more realistic system: a 32-bit CPU with 32 lines for addressing. Clearly, each process has a VAS of 2^32, a fairly large quantity of 4 GB.

4 GB in hexadecimal format is 0x100000000; so the VAS spans from the low address of 0x0 to the high address of 4GB - 1 = 0xffff ffff.

However, we have yet to learn more details (see the Advanced: VM split) regarding the exact usage of the high end of the VAS. Therefore, for the time being at least, let's just refer to this as the high address and not put a particular numerical value to it.

Here is its diagrammatic representation:

Fig 10: Process virtual address space (VAS)

So, the thing to understand for now is that on a 32-bit Linux, every process alive has this image:
0x0 to 0xffff ffff = 4 GB of virtual address space.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.128.39