Process Virtual Memory

Source: Internet
Author: User

Process Virtual Memory

1 Process address space

The process virtual memory address space starts at 0, terminates at Task_size-1, which is the kernel space, the total address space is divided by 3:1, the user process cannot access the kernel space, and if there is no protocol, a user process cannot access the space of other processes.

1.1 Layout of the process address space

A text segment of the current run code

Code of the dynamic library used by the B program

c Storage of global variables and dynamically generated data heap

D Save the stack of local variables and function/procedure calls

e environment variables and command line arguments

F file content mapped to memory mappings in virtual memory space

Each process has a mm_struct that holds the memory management information for the process.

Classic Layouts

Mmap addresses are typically 1/3 of virtual space

New layout

If the stack size is set to Unrestricted, select Use classic layout, otherwise use the new layout

1.2 Memory Map

In Mm_struct, the process virtual space information is represented by multiple regions, each region is described by Vm_area_struct, and a red-black tree is used to quickly find the area before the area when adding an area without having to scan the entire list

void* mmap (void* start,size_t length,int prot,int flags,int fd,off_t offset); int Munmap (void* start,size_t length);

The Mmap function creates a length at the beginning of the virtual address space, and the access rights are defined as prot

Process Virtual Memory

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.