CSCI 4320 (Principles of Operating Systems), Fall 2008:
Homework 5
- Assigned:
- November 10, 2008.
- Due:
- November 17, 2008, at 5pm.
- Credit:
- 10 points.
Be sure you have read Chapter 3.
Answer the following questions. You may write out your answers by
hand or using a word processor or other program, but please submit
hard copy, either in class or in my mailbox in the department office.
- (5 points)
Consider a small computer system with only four
page frames. Suppose you have implemented the aging
algorithm for page replacement, using 4-bit counters
and updating the counters after every clock tick,
and suppose the
bits for the four pages are as
follows after the first four clock ticks.
Time |
bit (page 0) |
bit (page 1) |
bit (page 2) |
bit (page 3) |
after tick 1 |
0 |
1 |
1 |
1 |
after tick 2 |
1 |
0 |
1 |
1 |
after tick 3 |
1 |
0 |
1 |
0 |
after tick 4 |
1 |
1 |
0 |
1 |
What are the values of the counters (in binary)
for all pages after these four clock ticks?
If a page needed to be removed at that point,
which page would be chosen for removal?
- (5 points)
A computer at Acme Company used as a compute server
(i.e., to run batch jobs) is observed to be running slowly
(turnaround times longer than expected).
The system uses demand paging, and there is a separate disk
used exclusively for paging.
The sysadmins are puzzled by the poor performance,
so they decide to monitor the system.
It is discovered that
the CPU is in use about 20% of the time, the paging disk
is in use about 98% of the time, and other disks are in
use about 5% of the time. For each of the following,
say whether it would be likely to increase CPU utilization
and why.
- Installing a faster CPU.
- Installing a larger paging disk.
- Increasing the number of processes (degree of
multiprogramming).
- Decreasing the number of processes (degree of
multiprogramming).
- Installing more main memory.
- Installing a faster paging disk.
Do the following programming problems. You will end up with at
least one code file per problem.
Submit your program source (and any other needed files)
by sending mail to
bmassing@cs.trinity.edu,
with each file as an attachment.
Please use a subject line that mentions the course number and
the assignment (e.g., ``csci 4320 homework 5'').
You can develop your programs on any system that provides the
needed functionality, but I will test them on one of the department's
Fedora 9 Linux machines, so you should probably make sure they work
in that environment before turning them in.
- (Optional -- up to 10 extra-credit points)
The starting point for this problem is a Java program
that simulates execution of a page replacement algorithm.
Currently the program simulates only the FIFO algorithm.
Your mission is to make it simulate one or more of the other
algorithms mentioned in the text.
The more algorithms you correctly simulate, the more points
you will receive.
The program consists of several classes,
collected in a package called pra:
- API documentation.
- Code.
(Class PageReplacerTest
contains a main method to test all algorithms.
Class PageReplacerFIFO
contains a main method to test just this algorithm.
Your class(es) could behave similarly.)
- Sample input.
- Sample input.
Feel free to rewrite anything about this program, including
starting over in a language of your choice.
Just remember that the program has
to run on one of the department Linux machines,
and it needs to accept input from standard input -- i.e.,
no GUIs, Web-based programs, etc.
The latter requirement
is to make it easier for me to test your code,
at least partially automatically.
If you make changes to the format of the input -- and I prefer
that you don't --
change the comments so they describe
the changed requirements.
Make the following assumptions:
- Initially memory is empty.
- All memory references are valid -- if the page is not in
memory, it can be read in from disk. (You don't have to
simulate that part, just count how often it happens.)
Berna Massingill
2008-11-10