本次代写是一个C语言操作系统的assignment
1 Introduction
OS/161 has a very simple virtual memory system, called dumbvm. Assignment 3 is to replace dumbvm with
a new virtual memory system that relaxes a few of dumbvm’s limitations.
2 Code Review
As usual, you should begin with a careful review of the existing OS/161 code with which you will be working.
The rest of this section of the assignment identifies some important files for you to consider.
In kern/vm
This directory is intended to hold machine-independent parts of the virtual memory implementation.
• kmalloc.c: This file contains implementations of kmalloc and kfree, to support dynamic memory
allocation for the kernel.
• uw-vmstats.c: contains code for tracking statistics related to the virtual memory system. Not used
for this assignment.
• copyinout.c: contains code for copying data between applications and the kernel.
In kern/syscall
loadelf.c: This file contains the functions responsible for loading an ELF executable from the filesystem
into virtual memory space. You should already be familiar with this file from Assignment 2.
In kern/include
addrspace.h: Defines the addrspace interface. You may need to make changes here, at least to define an
appropriate addrspace structure.
vm.h: Some VM-related definitions, including prototypes for some key functions, such as vm fault (the
TLB miss handler) and alloc kpages (used, among other places, in kmalloc).
In kern/arch/mips/vm
dumbvm.c: This file contains the implementation of the dumbvm virtual memory system, including the
implementation of the addrspace functions and vm fault, which is the kernel’s handler function for
exceptions related to virtual memory. It also includes some very simple functions (e.g., alloc kpages)
for physical memory management.
ram.c: This file includes functions that the kernel uses to manage physical memory (RAM) while the kernel
is booting up, before the VM system has been initialized. Since your VM system will essentially be
taking over management of physical memory, you need to understand how these functions work.
In kern/arch/mips/include
tlb.h: This file defines the prototypes for the kernel’s functions for managing the TLB (such as tlb write),
as well as definitions of the fields in each TLB entry.
vm.h: This file defines some macros and constants (such as the page size) related to address translation on
the MIPS. Note that this vm.h is different from the vm.h in kern/include.
3 Implementation Requirements
All code changes for this assignment should be enclosed in #if OPT A3 statements, as you have done with
OPT A2 and OPT A1 in the previous assignments. For this to work, you must add #include “opt-A3.h” at
the top of any file for which you make changes for this assignment.
By default, any code changes that you made for Assignments 1 and 2 will be included in your build when
you compile for Assignment 3.