Required Reading –
- Translate.h / .cc – Each object of this class is a translation of a single virtual page to a physical page.
- Addrspace.h / .cc – Consists of all data needed to keep track of executing user programs. The constructor allocates memory/pages to processes assuming every virtual address is the same as its physical address. This restricts us to running one user program at a time. In this project we modify the constructor to allow multiple user programs to be run concurrently.
- Progtest.cc – The StartProcess function serves as the starting point of every thread, where the addrspace is created and execution of the userprogram begins. You might have to create a similar function to account for new threads that you create.
- System.h / .cc – All global/system objects are defined here.
- Machine.h / .cc - emulates the part of the machine that executes user programs: main memory, processor registers, etc.
To implement multiprogramming we will have to alter Nachos so that each process is maintained in its own system thread. We will have to take care of memory allocation and de-allocation. Here are the details:
- Add a case in exception handler so that non-system call exceptions can finish (currentThread>Finish()) the thread. This will be important, as a run time exception should not cause the operating system to shut down.
- Implement multiprogramming. The code we have given you is restricted to running one user program at a time. You will need to make some changes to addrspace.h, and addrspace.cc in order to convert the system from uniprogramming to multiprogramming. You will need to:
- Come up with a way of allocating physical memory frames so that multiple programs can be loaded into memory at once.
- Provide a way of copying data to/from the kernel from/to the user’s virtual address space.
- Properly handling freeing address space when a user program finishes.
- It is very important to alter the user program loader algorithm such that it handles memory in terms of pages. Currently, memory space allocation assumes that a process is loaded into a contiguous section of memory. Once multiprogramming is active, memory will no longer appear contiguous in nature. If you do not correct the routine, it is most likely that loading another user program will corrupt the operating system.






