Read the nuclear diary (eight)

xiaoxiao2021-03-06  102

Reading nuclear diary (eight) --linux memory management (2) This article comes from: http: //os.silversand.net Author: sunmoon (2001-09-02 07:05:00)

The mapping mechanism of the address mapping mechanism, mainly completes the main memory. Sucalyptus. And the association between the virtual memory. Include the disk file to the false map and the mapping of the virtual storage and the process schedule .Linux uses a range of data structures, and a hardware cache (TLB) to implement address mapping mechanisms. MM_STRUT is used to describe the cache of the process. Struct mm_struct {struct vm_area_struct * mmap; / * list of vmas * / struct vm_area_struct * mmap_AVL ; / * tree of VMAs * / struct vm_area_struct * mmap_cache; / * last find_vma result * / pgd_t * pgd; atomic_t count; int map_count; / * number of VMAs * / struct semaphore mmap_sem; spinlock_t page_table_lock; unsigned long context; 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; unsigned long rss, total_vm, locked_vm; unsigned long def_flags; unsigned long cpu_vm_mask; unsigned long swap_cnt; / * number of pages to swap on next pass * / unsigned long swap_address; / * * This is an architecture-specific pointer: the portable * part of Linux does not know about any segments * / void * segments;}; he described a process. Page catalog, context information about the process. And data. Code. The revelation of the stack ends the address. There is also a virtual storage number. And the display store Pointer. His range of high-level VM_Area-struct is a virtual address area describing the process. He forms an algorithmic chain table. Press the virtual address descending. This requires a given operation on a given process page. When you find this in the two-way list. Processions for the Related Pages. Such as. Page error. Page replacement, etc. His specific structure is as follows: Struct VM_AREA_STRUCT {structure mm_struct * VM_MM; / * VM Area parameters * / unsigned long vm_start; unsigned long vm_end; / * linked list of VM areas per task, sorted by address * / struct vm_area_struct * vm_next; pgprot_t vm_page_prot; unsigned short vm_flags; / * AVL tree of VM areas per task, sorted by address * / short vm_avl_height; struct vm_area_struct * vm_avl_left; struct vm_area_struct * vm_avl_right;. / * for areas with inode, the list inode-> i_mmap, for shm areas, * the list of attaches, otherwise unused * / struct vm_area_struct * vm_next_share; struct vm_area_struct ** VM_PPREV_SHARE;

转载请注明原文地址:https://www.9cbs.com/read-104123.html

New Post(0)