欢迎来到天天文库
浏览记录
ID:42595846
大小:36.69 KB
页数:26页
时间:2019-09-18
《linux内核虚拟内存管理算法》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、操作系统第十次实验张焓1.实验名称:虚拟内存管理算法2.实验目的:1.分析算法设计原理;2.写出算法伪代码;3.从算法的执行效率等方面分析算法的性能。3.实验方法通过阅读linux内核代码中管理虚拟内存的代码段学习虚拟内存管理算法的原理。4.实验步骤(1)mm_struct结构体,定义了每个进程的虚拟存储用户区,首地址在任务结构体中,定义在/include/linux/schedul.h中structmm_struct{structvm_area_struct*mmap;/*listofVMAs*/stru
2、ctrb_rootmm_rb;u32vmacache_seqnum;/*per-threadvmacache*/#ifdefCONFIG_MMUunsignedlong(*get_unmapped_area)(structfile*filp,unsignedlongaddr,unsignedlonglen,unsignedlongpgoff,unsignedlongflags);#endifunsignedlongmmap_base;/*baseofmmaparea*/unsignedlongmmap_le
3、gacy_base;/*baseofmmapareainbottom-upallocations*/unsignedlongtask_size;/*sizeoftaskvmspace*/unsignedlonghighest_vm_end;/*highestvmaendaddress*/pgd_t*pgd;atomic_tmm_users;/*Howmanyuserswithuserspace?*/atomic_tmm_count;/*Howmanyreferencesto"structmm_struct"
4、(userscountas1)*/atomic_long_tnr_ptes;/*PTEpagetablepages*/#ifCONFIG_PGTABLE_LEVELS>2atomic_long_tnr_pmds;/*PMDpagetablepages*/#endifintmap_count;/*numberofVMAs*/spinlock_tpage_table_lock;/*Protectspagetablesandsomecounters*/structrw_semaphoremmap_sem;stru
5、ctlist_headmmlist;/*Listofmaybeswappedmm's.Thesearegloballystrung*togetheroffinit_mm.mmlist,andareprotected*bymmlist_lock*/unsignedlonghiwater_rss;/*High-watermarkofRSSusage*/unsignedlonghiwater_vm;/*High-watervirtualmemoryusage*/unsignedlongtotal_vm;/*Tot
6、alpagesmapped*/unsignedlonglocked_vm;/*PagesthathavePG_mlockedset*/unsignedlongpinned_vm;/*Refcountpermanentlyincreased*/unsignedlongdata_vm;/*VM_WRITE&~VM_SHARED&~VM_STACK*/unsignedlongexec_vm;/*VM_EXEC&~VM_WRITE&~VM_STACK*/unsignedlongstack_vm;/*VM_STACK
7、*/unsignedlongdef_flags;unsignedlongstart_code,end_code,start_data,end_data;unsignedlongstart_brk,brk,start_stack;unsignedlongarg_start,arg_end,env_start,env_end;unsignedlongsaved_auxv[AT_VECTOR_SIZE];/*for/proc/PID/auxv*//**Specialcounters,insomeconfigura
8、tionsprotectedbythe*page_table_lock,inotherconfigurationsbybeingatomic.*/structmm_rss_statrss_stat;structlinux_binfmt*binfmt;cpumask_var_tcpu_vm_mask_var;/*Architecture-specificMMcontext*/mm_context_tcontext;
此文档下载收益归作者所有