Linux Process virtual address space

Source: Internet
Author: User

In Linux, the virtual address space for each process is independent. The virtual address space for each process starts at 0 and extends to task_size-1.

In the system, the kernel allocates 1GB, while the portions available for each user-space process are 3GB.

The process virtual address space consists of a number of regions,

1. Binary code of the currently running code. Text segment.

2. Dynamic library code used by the program.

3. Data segment of the storage area and static variables, Bss,data segment

4. Save a heap that dynamically allocates data

5. Save the local variable and the stack that implements the function call

6. Environment variables and command line arguments.

7. The file content is mapped to a memory map of the virtual address space.

As shown in the specific layout,

If the global variable randomize_va_space is set to 1, then the address space randomization mechanism (ramdom XXX offset) is enabled. Users can deactivate this feature through/proc/sys/kernel/randomize_va_space.

Each process has an instance of Mm_struct (Linux/mm_types.h) that holds the process virtual memory management information.

struct Mm_struct {
struct vm_area_struct *mmap;/* List of VMAs */
struct Rb_root mm_rb;
#ifdef CONFIG_MMU
unsigned long (*get_unmapped_area) (struct file *filp,unsigned long addr, unsigned long len,unsigned long pgoff, unsigned Long flags);
#endif
unsigned long mmap_base;/* base of mmap area */
unsigned long mmap_legacy_base; /* Base of mmap area in bottom-up allocations */
unsigned long task_size;/* size of task VM space */

struct List_head mmlist;/* List of maybe swapped mm ' S.these are globally strung

unsigned long start_code, End_code, Start_data, End_data;
unsigned long start_brk, BRK, Start_stack;
unsigned long arg_start, arg_end, Env_start, env_end;

....

};

Linux Process virtual address space

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.