linux内核虚拟内存管理算法.docx
文本预览下载声明
操作系统第十次实验张焓实验名称:虚拟内存管理算法实验目的:1.分析算法设计原理;2.写出算法伪代码;3.从算法的执行效率等方面分析算法的性能。实验方法通过阅读linux内核代码中管理虚拟内存的代码段学习虚拟内存管理算法的原理。实验步骤mm_struct结构体,定义了每个进程的虚拟存储用户区,首地址在任务结构体中,定义在/include/linux/schedul.h中structmm_struct {structvm_area_struct *mmap;/* list of VMAs */structrb_root mm_rb;u32 vmacache_seqnum; /* per-thread vmacache */#ifdef CONFIG_MMUunsignedlong (*get_unmapped_area) (struct file *filp,unsignedlong addr, unsignedlong len,unsignedlong pgoff, unsignedlong flags);#endifunsignedlong mmap_base;/* base of mmap area */unsignedlong mmap_legacy_base; /* base of mmap area in bottom-up allocations */unsignedlong task_size;/* size of task vm space */unsignedlong highest_vm_end;/* highest vma end address */pgd_t * pgd;atomic_t mm_users;/* How many users with user space? */atomic_t mm_count;/* How many references to struct mm_struct (users count as 1) */atomic_long_t nr_ptes;/* PTE page table pages */#if CONFIG_PGTABLE_LEVELS 2atomic_long_t nr_pmds;/* PMD page table pages */#endifint map_count;/* number of VMAs */spinlock_t page_table_lock;/* Protects page tables and some counters */structrw_semaphore mmap_sem;structlist_head mmlist;/* List of maybe swapped mms.These are globally strung * together off init_mm.mmlist, and are protected * by mmlist_lock */unsignedlong hiwater_rss;/* High-watermark of RSS usage */unsignedlong hiwater_vm;/* High-water virtual memory usage */unsignedlong total_vm;/* Total pages mapped */unsignedlong locked_vm;/* Pages that have PG_mlocked set */unsignedlong pinned_vm;/* Refcount permanently increased */unsignedlong data_vm;/* VM_WRITE ~VM_SHARED ~VM_STACK */unsignedlong exec_vm;/* VM_EXEC ~VM_WRITE ~VM_STACK */unsignedlong stack_vm;/* VM_STACK */unsignedlong def_flags;unsignedlong start_code, end_code, start_data, end_data;unsignedlong start_brk, brk, start_stack;unsignedlong arg_start, arg_end, env_start, env_end;unsignedlong saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv *//* * Special counters, in some configurations pro
显示全部