Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems ECE344 Ding Yuan Lab assignment 3: Memory management.

Similar presentations


Presentation on theme: "Operating Systems ECE344 Ding Yuan Lab assignment 3: Memory management."— Presentation transcript:

1 Operating Systems ECE344 Ding Yuan Lab assignment 3: Memory management

2 Overview The most challenging problem for any OS You need to implement all (yes, I mean ALL) the memory management features we discussed – Page table (possibly two-level) – TLB management – Handling TLB miss – Copy-on-write – Demand paging Load the pages from disk on demand Swapout when RAM is full – Smart page replacement Ding Yuan, ECE344 Operating System2

3 MIPS TLB Management Software managed TLB – OS handles TLB fault How? vm_fault(int faulttype, vaddr_t faultaddress) Difference with x86 (hw. managed TLB) – Do you need to worry about “page fault”? – When you design your two-level page-table, do you still need to use only physical addr. in master PT? – Do you still need to store the addr. of master PT in a register on every context switch? Ding Yuan, ECE344 Operating System3

4 Challenges All the challenges you faced in lab 2 will come back – E.g., debugging user/kernel mode transition, synchronization, memory leak, etc. In addition: – Non-trivial designs Coremap data structure Page table data structure Replacement policy – Debugging memory-related bugs is hard TLB look-up is out of your control Ding Yuan, ECE344 Operating System4 Last-minute hacking without a clear design in mind will guarantee you a wild goose chase

5 A few hints You only need to implement invalidation-based TLB on context switches Implementing swap requires access to filesystem Ding Yuan, ECE344 Operating System5 struct vnode* swap_file; vfs_open("lhd0raw:", O_RDWR, &swap_file); // You can also use a regular filename VOP_WRITE(swap_file, uio); VOP_READ(swap_file, uio);

6 Advices Start early! Read code – Understand how dumbvm works will take you a loooooong way Explicitly assert all your assumptions – Debugging MM is frustrating – The most frustrating bugs are the ones with long propagation – Stop the errors early! Be careful with kprintf! No deadline extensions! – The prof. is a mean person… Don’t drink too much coffee Ding Yuan, ECE344 Operating System6


Download ppt "Operating Systems ECE344 Ding Yuan Lab assignment 3: Memory management."

Similar presentations


Ads by Google