Download presentation
Presentation is loading. Please wait.
1
Nachos Project 3
2
Goal Make Nachos can run following test cases in the same time
/test/matmult.c /test/sort.c The problem is that both of the test cases require a lot of memory(larger then physical memory)
3
Create Disk swap = new SynchDisk Use the disk as the swap space
Access the disk by kernel->swap->WriteSector kernel->swap->ReadSector See “synchdisk.cc” and other files in /filesys
4
Maintain Three Tables Physical memory FrameTable 1 2 3 4 PageTable 1 2
SwapTable 1 2 3 4
5
PageTable For each entry in PageTable
unsigned int virtualPage; //virtual memory page unsigned int physicalPage; //if in physical memory bool valid; //if in physical memory bool use; //been used(read or write) bool dirty; //been modified
6
FrameTable For each entry in FrameTable Bool valid; //if being used
Bool lock; AddrSpace *addrSpace; //which process is using this page Unsigned int vpn; //which virtual page of the process is stored in this page
7
SwapTable For each entry in SwapTable Bool valid; //if being used
Bool lock; AddrSpace *addrSpace; //which process is using this page Unsigned int vpn; //which virtual page of the process is stored in this page (same as the FrameTable)
8
Address Mapping Physical Address = pageTable[(virtual address / PageSize)].physicalPage * PageSize + (virtual address % PageSize)
9
Addrspace::Load Load 1 page a time
Ask for 1 page, if the FrameTable is full, select 1 frame and put it into SwapTable Mapping Address
10
Create new class “Memory Manager”
Int TransAddr(AddrSpace *space, int virtAddr); //return phyAddr Bool AcquirePage(AddrSpace *space, int vpn); //ask a page for vpn Bool ReleasePage(AddrSpace *space, int vpn); //free the page Void PageFaultHandler(); //will be called when manager want to swap a page from SwapTable to FrameTable and the FrameTable is full
11
Hand in report Report Mail your code and report to yyergg@gmail.com
tar zcvf b99xxxxxx.tar.gz ./nachos-4.0 Report Why the result is not congruent with expected How you modified Nachos to make it support multiprogramming – important code segments Mail your code and report to Deadline Jan
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.