Discussion Section: Wednesday, April 21, 1999
Getting Started with Lab 4


Implement a memory management scheme that does paging in addrspace.(h/cc)
 


Concept Here:


What to do:

Modify the address space code appropriately:

                Phyaddr = Virtaddr + base*PageSize;


Notice: the method RestoreState(). This method is called by scheduler.cc method Scheduler::Run() which sets the current pageTable to be that of the thread (process) swapped in. Thus, you don't have to worry about updating the page table to reflect which process you are running. This is a gift, but be aware that it happens.
 

Globally Speaking:

Implement an object to keep track of free pages: a page manager
This should take the form of:
                                    BitMap *pageManager

which you will have to declare and create a new instance of in system.cc (add anything you feel you need to add in system.h as well)

don't forget to delete it also in Cleanup()

bitmap must be updated whenever a process starts or stops
 

Now the Syscall functions

SyscallExit()  ...  what a user process calls to die

NOTE:  If you did not break your syscalls into functions in the last lab, you must do so in this lab.  One long ExceptionHandler function is unacceptable coding style.  ExceptionHandler should call SyscallExit, SyscallJoin, and SyscallExec as well as all of the other Syscall Functions.  You WILL loose points if you implement one large ExceptionHandler function again.

Read the values out of machine->readRegister(4), machine->readRegister(5), machine->readRegister(6) and send them as parameters to the functions.
 

SyscallExec()

forks and executes a new program in a new address space
Note: the initializing registers and state should be done after forking off the child thread

Note:

SyscallJoin()