Virtual address space for Linux process

 

Program code and data . Code begins at the same fixed address, followed by data locations that
correspond to global C variables. The code and data areas are initialized directly from the contents of
an executable object file, in our case the hello executable. We will learn more about this part of the
address 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 and
data areas, which are fixed in size once the process begins running, the heap expands and contracts
dynamically 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 for
shared libraries such as the C standard library and the math library. The notion of a shared library
is a powerful, but somewhat difficult concept. We will learn how they work when we study dynamic
linking in Chapter 7.
Stack. At the top of the user’s virtual address space is the user stack that the compiler uses to implement
function 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 we
return 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 in
memory. The top 1/4 of the address space is reserved for the kernel. Application programs are not
allowed to read or write the contents of this area or to directly call functions defined in the kernel
code.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值