Virtual address space for Linux process

Program code and data. Code begins at the same fixed address, followed by data locations thatcorrespond to global C variables. The code and data areas are initialized directly from the contents ofan executable object file, in our case the hello executable. We will learn more about this part of theaddress space when we study linking and loading in Chapter 7. Heap. The code and data areas are followed immediately by the run-time heap. Unlike the code anddata areas, which are fixed in size once the process begins running, the heap expands and contractsdynamically at runtime as a result of calls to C standard library routines such as malloc and free.We will study heaps in detail when we learn about managing virtual memory in Chapter 10. Shared libraries. Near the middle of the address space is an area that holds the code and data forshared libraries such as the C standard library and the math library. The notion of a shared libraryis a powerful, but somewhat difficult concept. We will learn how they work when we study dynamiclinking in Chapter 7. Stack. At the top of the user’s virtual address space is the user stack that the compiler uses to implementfunction calls. Like the heap, the user stack expands and contracts dynamically during the execution

of the program. In particular, each time we call a function, the stack grows. Each time wereturn from a function, it contracts. We will learn how the compiler uses the stack in Chapter 3. Kernel virtual memory. The kernel is the part of the operating system that is always resident inmemory. The top 1/4 of the address space is reserved for the kernel. Application programs are notallowed to read or write the contents of this area or to directly call functions defined in the kernelcode.

一个人去旅行,而且是去故乡的山水间徜徉。

Virtual address space for Linux process

相关文章:

你感兴趣的文章:

标签云: