Homeworks are not mandatory; rather, they are things you can do in your own time to see if you have really understood something. The basic idea is simple: each of the programs below let you both generate and get solutions for an infinite number of problems. They are meant to firm up your understanding of some of the basic concepts we discussed in class. In some cases, a few suggested problems are given.
Note: All of these scripts and README files are now available online here as well as in the file system at the path names listed below. Or, just download all the homeworks in one fantastic tarball here.
Homework 1: Scheduling
Homework 2: Segmentation
Some questions: Run the following and see if you can calculate the translations. What do you expect to happen when the limit registers values are increasing? To what values should the limit registers be set in order to avoid any segmentation violations?
./segmentation.py -s 0 -a 64 -p 1024 -b 128 -B 1024 -l 5 -L 5
As compared to dynamic relocation (i.e., one base/bounds pair per address space), how much physical memory is saved in the above example by using segmentation? Could you come up with an equation to determine the answer?
Homework 3: Linear Page Tables (Size)
./paging-linear-size.py -v 16 -p 4kThen, to understand how linear page table size changes as page size grows:
./paging-linear-size.py -v 32 -p 1kBefore running any of these, try to think about the expected trends. How should page-table size change as the address space grows? As the page size grows? Why shouldn't we just use really big pages in general?
Homework 4: Linear Page Tables (Translations)
Homework 5: Paging Policies
Some examples (from the handout) to compare how OPT, FIFO, and LRU perform:
./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p OPT -C 3 ./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p FIFO -C 3 ./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p LRU -C 3Or to discover Belady's anomaly (using FIFO, while increasing cache size):
./paging-policy.py -a 1,2,3,4,1,2,5,1,2,3,4,5 -p FIFO -C 3 ./paging-policy.py -a 1,2,3,4,1,2,5,1,2,3,4,5 -p FIFO -C 4
Homework 6: Multi-level Page Tables