Homeworks

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.
Available in ~cs537-1/homeworks/scheduler . Read the README file therein and then run scheduler.py to test your knowledge of different scheduling policies and the metrics we use to evaluate them.

Homework 2: Segmentation.
Available in ~cs537-1/homeworks/segmentation . Read the README file therein and then run segmentation.py to test your knowledge of how segmentation works and the general process of virtual-to-physical address translation in a simple segmented system.

Homework 3: Linear Page Tables (Size).
Available in ~cs537-1/homeworks/paging-linear-size . Read the README and run the program paging-linear-size.py to see if you understand how to compute the size of linear page tables as different parameters change. Some suggested inputs are below. First, to understand how linear page table size changes as the address space grows:

prompt> ./paging-linear-size.py -v 16 -p 4k
prompt> ./paging-linear-size.py -v 24 -p 4k
prompt> ./paging-linear-size.py -v 32 -p 4k
Then, to understand how linear page table size changes as page size grows:
prompt> ./paging-linear-size.py -v 32 -p 1k
prompt> ./paging-linear-size.py -v 32 -p 2k
prompt> ./paging-linear-size.py -v 32 -p 8k
prompt> ./paging-linear-size.py -v 32 -p 1m
Before 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).
Available in ~cs537-1/homeworks/paging-linear-translate . Read the README and run the program paging-linear-translate.py to see if you understand how to compute translations from virtual to physical addresses.

Homework 5: Paging Policies.
Available in ~cs537-1/homeworks/paging-policy . Read the README and run the program paging-linear-translate.py to see if you understand how the different page-replacement policies work, such as LRU, FIFO, and OPT.

Some examples (from the handout) to compare how OPT, FIFO, and LRU perform:

prompt> ./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p OPT -C 3 prompt> ./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p FIFO -C 3 prompt> ./paging-policy.py -a 0,1,2,0,1,3,0,3,1,2,1 -p LRU -C 3
Or to discover Belady's anomaly (using FIFO, while increasing cache size):
prompt> ./paging-policy.py -a 1,2,3,4,1,2,5,1,2,3,4,5 -p FIFO -C 3 prompt> ./paging-policy.py -a 1,2,3,4,1,2,5,1,2,3,4,5 -p FIFO -C 4