讨论:Nachos 2013: Caching and virtual memory
used bit会定期清零吗?
不会,除非你自己的代码里面清零了,或者在该(x.used |= y.used)一下的时候没有(x.used |= y.used)一下
第三个task里面data page那些是什么意思?我们怎么区分data page?
类似于tiger的,data pages可以理解成,在你们生成的汇编程序里面的 .data .bss 之类的,就是比如一些全局变量与常量之类的东西,会加载进的page
task 3里面说注意不要把data page的更改写回executable file。我们的操作系统自身应该本来就只是会读写内存或swap file吧,只有在用户说要写file的时候才会写file,那什么时候会牵扯到改executable file?
task 3那句话是说,实现lazy loading的时候,如果不想拷贝data page到统一的SWAP管理,而直接用executable file的data page来support虚存的话,这可能会导致把data page的更改写回executable file。 这是设计时要考虑的问题,不是设计时一定会遇上这样的问题。。。
操作系统自身的内存使用是由谁管里的?
Nachos是运行在jvm上的,不是运行在硬件之上的,和真实的操作系统有区别。
proj3 directory是什么?
vm
phase3用哪个调度器测?
ThreadedKernel.scheduler = nachos.threads.LotteryScheduler
SWAP文件的名字?
统一用SWAP,注意大小写
同时确保userprog\userProcess.java中包含语句 "protected final int stackPages = Config.getInteger("Processor.numStackPages", 8);"
proj3.conf 设置
注意不同的测试点可能会使用不同的proj3.conf来跑的,主要是numStackPages和numPhysPages两个参数会有所不同,具体可以参考各测试点对应在doc里面的说明 这是proj3.conf的一个(应该是非常宽松的)样例,有疑问请尽快提出
Machine.stubFileSystem = true Machine.processor = true Machine.console = true
Machine.graphicalConsole = false Machine.networkLink = false Processor.usingTLB = true
Processor.numPhysPages = 16 Processor.numStackPages = 32 NachosSecurityManager.fullySecure = false
ThreadedKernel.scheduler = nachos.threads.LotteryScheduler
- ThreadedKernel.scheduler = nachos.threads.RoundRobinScheduler
Kernel.shellProgram = sh.coff Kernel.processClassName = nachos.vm.VMProcess Kernel.kernel = nachos.vm.VMKernel
vm_recursion的conf 配置
Machine.stubFileSystem = true Machine.processor = true Machine.console = true Machine.graphicalConsole = false Machine.networkLink = false Processor.usingTLB = true Processor.numPhysPages = 16 Processor.numStackPages = 64 NachosSecurityManager.fullySecure = false ThreadedKernel.scheduler = nachos.threads.LotteryScheduler Kernel.shellProgram = sh.coff Kernel.processClassName = nachos.vm.VMProcess Kernel.kernel = nachos.vm.VMKernel
测试点运行时间限制
testcases = [("vm_echo", "-[] ../test/proj3_4p.conf -- nachos.ag.VMGrader -x vm_echo.coff -# output=vm_echo.out", 3), ("vm_lazyload", "-[] ../test/proj3_4p.conf -- nachos.ag.VMGrader -x vm_lazyload.coff -# swapFile=SWAP", 3), ("vm_matrix", "-[] ../test/proj3_16p.conf -- nachos.ag.VMGrader -x vm_matrix.coff -# output=vm_matrix.out", 30), ("vm_matrix2", "-[] ../test/proj3_16p.conf -- nachos.ag.VMGrader -x vm_matrix2.coff -# output=vm_matrix.out,swapFile=SWAP", 60 * 2), ("vm_matrix(8 pages)", "-[] ../test/proj3_8p.conf -- nachos.ag.VMGrader -x vm_matrix.coff -# output=vm_matrix.out", 60 * 2), ("vm_matrix2(8 pages)", "-[] ../test/proj3_8p.conf -- nachos.ag.VMGrader -x vm_matrix2.coff -# output=vm_matrix.out,swapFile=SWAP", 60 * 3), ("vm_reuse", "-[] ../test/proj3_4p.conf -- nachos.ag.VMGrader -x vm_reuse.coff -# coffPar0=10,swapFile=SWAP", 10), ("vm_skipfill", "-[] ../test/proj3_16p.conf -- nachos.ag.VMGrader -x vm_skipfill.coff -# coffPar0=5,coffPar1=32,coffPar2=6", 60), ("vm_recursion", "-[] ../test/proj3_recursion.conf -- nachos.ag.VMGrader -x vm_recursion.coff -# coffPar0=20,coffPar1=6,swapFile=SWAP", 5)]