In this assignment, you'll be modifying your operating system to let the hardware run programs larger than 32 blocks, and you'll be doing it by implementing paged virtual memory.
sys_base
to dev_top
- 1 (inclusive at both ends), while a valid
virtual address occupies the range vmem_base
to vmem_top
- 1
(inclusive at both ends).
memory.h
.
pa3-2blkpgm.dsk
- Contains a single, simple two-block program that
does nothing.
$ os3 -d pa3-2blkpgm.dsk The system is halted. Total execution time: 97 ticks, idle time: 29 ticks (29%). $
pa3-lheapsort.dsk
- Contains one program that heap sorts an array
of 1600 words. The array contains the numbers 1 through 1600 randomly shuffled;
the program checks to see that the array is sorted in ascending order; that is,
that array[i] = i.
$ os3 -d pa3-lheapsort.dsk The system is halted. Total execution time: 585694 ticks, idle time: 8713 ticks (1%). $
cl os3 -d pa3-lheapsort.dsk * * * array isn't sorted in ascending order: a[5] = 100. The system is halted. Total execution time: 405983 ticks, idle time: 3121 ticks (0%). cl
pa3-llheapsort.dsk
- Contains two copies of the heap-sort
program, each one sorting a 1200-element array:
$ os3 -d pa3-llheapsort.dsk The system is halted. Total execution time: 835592 ticks, idle time: 10475 ticks (1%). $
pa3-smlheapsort.dsk
- Contains three copies of the heap-sort
program, one sorting a 1200-element array, one sorting a 1500 element array,
and the third sorting a 1800-element array:
$ os3 -d pa3-smlheapsort.dsk The system is halted. Total execution time: 1666302 ticks, idle time: 57283 ticks (3%). $
pa3-matmul.dsk
- Contains a program that multiplies two 22x22
matrices together:
$ os3 -d pa3-matmul.dsk The system is halted. Total execution time: 179860 ticks, idle time: 3489 ticks (1%). $
cl os3 -d pa3-matmul.dsk * * * Matrix multiplication failed: A[0, 0] = 205 != -182 = C[0, 0]. The system is halted. Total execution time: 170509 ticks, idle time: 2099 ticks (1%). cl
pa3-2matmul.dsk
- Contains two copies of the matrix multiplication
program:
cl os3 -d pa3-2matmul.dsk The system is halted. Total execution time: 369665 ticks, idle time: 16677 ticks (4%). cl
f29
-D option prints paging activity.
If you're looking looking for suggestions about how to approach this assignment, you might want to consider the following steps:
This step familiarizes you with virtual memory and the page table. Because all a process's pages are pre-loaded before execution, no page faults occur during process execution and there is no paging activity.
You will need to change your invalid-address interrupt handler to let it distinguish between invalid addresses and page faults, and to let it handle the page faults. Probably the easiest way to add paging is to make a process ready to run without reading in any of its pages; when it starts to execute, the process will page fault in its first page and you're off and running.
This technique is known as pure demand paging. An alternative is to implement prefetch - a process needs its first page, so just read it in and avoid the page fault. Prefetch is more efficient than pure demand paging is, but it is also, in my opinion, harder to implement than pure demand paging is.
To get a good grade on this assignment, your os should be able to do at least this much.
Once your os runs pa3-matmul.dsk, it should be able to handle all the pa3 disks.
This page last modified on 10 July 2002.