What you will learn:
Some issues in virtual memory management, page replacement, swapping
There are fewer physical frames in main memory than logical pages.
Hence all pages needed in system may not be in physical memory. In such
a case, swap space can be
used when needed to bring in a swapped out page in main memory and a
victim frame is swapped out.
A system has a few addressible pages (say 60 in entire system), few
frames in main memory (say 20)
and a few disk blocks (say 60) for swap space. The 3 numbers will be
provided as command line args
to your program. Implement an FIFO page replacement policy which
selects a victim page based on
the arrival of page into main memory. When a requested page is found to
be not available in main memory,
the event is termed as a page fault.
Fourth argument to your executable file will be filename. In this
file the sequence of page requests will be
given. You will start with a nil map of logical pages to frames and
build it on demand as and when requests
arrive.
A sample page requests file is given here.
You are required to plot a graph for the number of pagefaults (on
y-axis) against the total number of
frames (on x-axis) for a given request pattern file. Use gnuplot to
plot the graph.
A small
tutorial for gnuplot
The procedure for plotting a .ps graph from a data file is given below:
a)Store the data delimited by tabs,
here is a sample data file graph.dat
b)open the gnuplot command prompt by typing "gnuplot"
c)Inside gnuplot give the following commands :
set terminal postscript
set output "graph.ps"
plot
'graph.dat'
(to plot lines give: plot 'graph.dat' with lines)
d) The required graph is in graph.ps
Another tutorial for gnuplot can be found here
http://www.cs.uni.edu/Help/gnuplot/.
What to submit
your C program + request
pattern file + generated data file + gnuplot graph in ps format + README
Donot submit your binaries, executables. Your marks will be reduced if you do so.
Some Pointers
You can use fopen, fopen, fclose, fscanf etc for file i/o.
Submission
Assignment no=11.
Submit your file using ~oslab/submit script as in: ~oslab/submit 11
xyz.c reqfile datfile gr.ps
submit script accepts assignment no. in its first argument. Any number
of files may be submitted through subsequent arguments.
You may submit any number of times before 5:00pm. Old files are
overwritten in resubmission.
Deadline: 5:00pm