进程的虚存区域

来源:互联网 发布:windows phone x86 编辑:程序博客网 时间:2024/06/06 05:59

Linux的存储管理主要是管理进程的虚拟内存的用户区。进程虚拟内存的用户区分成代码段、数据段、堆栈以及进程运行的环境变量、参数传递区域等。每一个进程都用一个mm_struct结构体来定义它的虚拟用户区。mm_struct结构体首地址在任务结构体tast_struct成员项mm中。

一个虚拟区域是虚存空间的一个连续的区域,在这个区域中的信息具有相同的操作和访问特性。每个虚拟区域用一个vm_area_struct结构体来进行描述,它定义在"/include/linux/min.h"中

 

struct vm_area_struct{

      struct mm_struct *vm_mm;   //指向进程的mm_struct结构体

      unsigned long vm_start;     //虚拟区域的开始地址

      unsigned long vm_end;       //虚拟区域的终止地址

     

      struct vm_area_struct *vm_next;   //指向下一个vm_area_struct结构体。链表首地址由mm_struct中成员项mmap指出

 

      pgprot_t vm_page_prot;     //虚存区域的页面保护特性

      unsigned long vm_flags;     //虚拟区域的操作特性

 

      struct rb_node vm_rb;   

 

      union{

             struct{

                     struct list_head list;

                     void *parent;

                     struct vm_area_struct *head;

             }vm_set;

            

              struct raw_prio_tree_node prio_tree_node;

      }shared;

 

      struct list_head anon_vma_node;

      struct anon_vma *anon_vma;

 

      struct vm_operations_struct *vm_ops;  // 指向vm_operations_struct结构体的指针。

                                                                     //该结构体中包含着指向各种操的函数指针

 

      unsigned long vm_file;

      struct file *vm_file;

      void *vm_private_data;

      unsigned long vm_truncate_count;

 

#ifndef CONFIG_MMU

      atomic_t vm_usage;

#endif

#ifdef CONFIG_NUMA

      struct mempolicy *vm_policy;

#endif

};

原创粉丝点击