
Implementing Memory Management Features in Operating Systems ECE344 Lab Assignment 3
Dive into the complex world of memory management with the challenges presented in ECE344 Lab Assignment 3 by Ding Yuan. From implementing page tables to smart page replacement, handle TLB management, demand paging, and more. Be prepared for debugging, synchronization, and designing core data structures. Follow advice, start early, read code thoroughly, and be cautious to tackle frustrating bugs effectively.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Operating Systems ECE344 Lab assignment 3: Memory management Ding Yuan
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 System 2
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 System 3
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 Last-minute hacking without a clear design in mind will guarantee you a wild goose chase Ding Yuan, ECE344 Operating System 4
A few hints You only need to implement invalidation-based TLB on context switches Implementing swap requires access to filesystem 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); Ding Yuan, ECE344 Operating System 5
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 System 6