COP4600 – Assignment 2: Measuring the Performance of Page Solved

24.99 $

Description

5/5 - (1 vote)

Replacement Algorithms on Real Traces

Learning Objective:
• Understand the costs of page replacement algorithms
• Observe the effect of memory traces and the effect of page replacement algorithms on system performance.

In this project you are to evaluate how real applications respond to a variety of page replacement algorithms. For this, you are to write a memory simulator and evaluate memory performance using provided traces from real applications.

The deliverables of this project are:

1. A report (in PDF) that includes:
o Your name(s). o A short presentation of the problem you address (hopefully not cut and pasted from this document or the paper, but written in your own words).
o A report of the results and detailed interpretation of the results. o An estimation of the time (each of) you spent working on the project.

There is no requirement on the length of your report: you’ll be graded based on how well your report shows your understanding of the problem.

2. A zip file with all of your files in one folder with your name(s). The zip file needs to include the following:
o A makefile for easy compilation, the C program(s). The makefile target executable should be called memsim.
o A README file that describes how to run your project (e.g., arguments, etc). o Code that implements the objectives of this project. Please do not include your name in the code.

Memory Traces

You are provided with memory traces to use with your simulator. Each trace is a real recording of a running program, taken from the SPEC benchmarks. Real traces are enormously big: billions and billions of memory accesses. However, a relatively small trace will be more than enough to keep you busy. Each trace only consists of one million memory accesses taken from the beginning of each program. The traces are the following (linked from the Canvas project): 1. bzip.trace 2. sixpack.trace
Each trace is a series of lines, each listing a hexadecimal memory address followed by R or W to indicate a read or a write. For example:

0041f7a0 R
13f5e2c0 R
05e78900 R
004758a0 R
31348900 W

Note, to scan in one memory access in this format, you can use fscanf() as in the following: unsigned addr; char rw; …
fscanf(file,”%x %c”,&addr,&rw);

Simulator Requirements

Your job is to build a simulator that reads a memory trace and simulates the action of a virtual memory system with a single level page table. Your simulator should keep track of what pages are loaded into memory. As it processes each memory event from the trace, it should check to see if the corresponding page is loaded. If not, it should choose a page to remove from memory. If the page to be replaced is “dirty” (that is, previous accesses to it included a Write access), it must be saved to disk. Finally, the new page is to be loaded into memory from disk, and the page table is updated. Assume that all pages and page frames are 4 KB (4096 bytes).

Of course, this is just a simulation of the page table, so you do not actually need to read and write data from disk. Just keep track of what pages are loaded. When a simulated disk read or write must occur, simply increment a counter to keep track of disk reads and writes, respectively.

Implement the following page replacement algorithms to replicate the experimental evaluation in this 1981 paper11:
1. FIFO
2. LRU
3. Segmented FIFO (see 1981 paper on Canvas)

1
Rollins Turner and Henry Levy. 1981. Segmented FIFO page replacement. In Proceedings of the 1981 ACM SIGMETRICS conference on Measurement and modeling of computer systems (SIGMETRICS ’81). Association for Computing Machinery, New York, NY, USA, 48–51.
DOI:https://doi.org/10.1145/800189.805473

You need to follow strict requirements on the interface to your simulator so that we will be able to test and grade your work in an efficient manner. The simulator (called memsim) should take the following arguments:

memsim <tracefile> <nframes> <lru|fifo|vms> <debug|quiet>

If the fourth argument is “quiet”, then the simulator should run silently with no output until the very end, at which point it should print out a few simple statistics like this (follow the format as closely as possible):

total memory frames: 12 events in trace: 1002050 total disk reads: 1751 total disk writes:
932

If the third argument is “vms”, you have to take an extra parameter that indicates the percentage of the total program memory to be used in the secondary buffer. In that case, the simulator should take the following arguments:

memsim <tracefile> <nframes> <lru|fifo|vms> <p> <debug|quiet>
“p” will be a number between 1 to 100.

Use separate functions for each page replacement algorithm, i.e., your program must declare the following high level functions: fifo(), lru(), segmented-fifo().

Project Report

An important component of this project will be to write a report describing and evaluating your work and presenting your results using both tables and plots (use Excel or Matlab or another tool of your choice). You should think of this project as if it were a lab experiment in a physics or chemistry class. Your goal is to use the scientific method to learn as much as you can about the provided memory traces. For example, how much memory does each traced program actually need? What is the working set of each program? Which page replacement algorithm works best? Does one algorithm work best in all situations? If not, what situations favor what algorithms? Use the paper that described Segmented FIFO as guidance for how to present your experimental data. Do your observations confirm the results of the paper?

Your report should have the following sections:

1. Introduction: A section that explains the essential problem of page replacement and briefly summarizes the structure and implementation of your simulator. Do not copy and paste text from this project description. In your own words, describe the overall structure and purpose of the experiment.

3. Results: A description of the results obtained by running your experiments. Present the results using tables and plots that show the performance of each algorithm over a range of available memory. For instance, include a plot of hit rate vs. memory size for each algorithm. In the text, summarize what each plot or table shows and point out any interesting or unusual data points. Compare the results obtained from the two trace files – are there any differences in the performance you see? What might explain these differences? Which is the algorithm that shows the biggest difference? What do you think happens?

4. Conclusions: Describe what you have learned from the experimental results. What have you learned about the memory traces? What have you learned about the paging algorithms? How does the size of available memory affect memory performance? Be sure to describe clearly how specific results above lead you to these conclusions.

The majority of your report grade will be drawn from the methods, results, and conclusions. Think carefully about how to run your simulator. Do not choose random input values. Instead, explore the space of memory sizes intelligently in order to learn as much as you can about the nature of each memory trace.

As with any written matter, the report should be well structured, clearly written, and free of typos and grammatical errors. A portion of your grade will cover these matters.

  • Project2-kfbd21.zip