Build a simulator that reads a memory trace and simulates

Assignment Help Computer Engineering
Reference no: EM132078933

You need some help with this project, it is to be written in C, if there are any questions please try to be specific so you can address them, thank you in advance! It's a memory simulator, you don't actually have to write to disk, just keep track of the addresses.

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:

gcc.trace

swim.trace

bzip.trace
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:

lru: least recently used.

clk: Clock

opt: optimal page replacement.

[Optional, for extra credit] VMS' second chance page replacement policy. You can find

its description in the textbook (page 249) and a more detailed description at the end of

this document.

Structure and write your simulator in any reasonable manner. You may need additional data structures to keep track of which pages need to be replaced depending on the algorithm implementation. Think carefully about which data structures you are going to use and make a reasonable decision.

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

The first argument gives the name of the memory trace file to use. The second argument gives the number of page frames in the simulated memory. The third argument gives the page replacement algorithm to use. The fourth argument may be "debug" or "quiet" (explained below.)

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 fourth argument is "debug", then the simulator should print out messages displaying the details of each event in the trace. You may use any format for this output, it is simply there to help you debug and test your code.

Use a separate functions for each algorithm, i.e.: your program must declare the following high level functions: lru(), clk(), opt() (and vms(), if implemented).

Reference no: EM132078933

Questions Cloud

Function in the circulatory system : How do the sickled red blood cells vary from the normal red blood cells? How might this affect their ability to function in the circulatory system?
Write a template function that returns the largest value : Write a template function that returns the largest value of three parameters. The function should operate with any numeric data types.
Prevalent cell type in blood : What is the most prevalent cell type in blood, and what is the least prevalent cell type in blood?
Determining the glycerol molecule : In a phospholipid, what are the three (monomeric) parts that are attached to the glycerol molecule?
Build a simulator that reads a memory trace and simulates : 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.
Make the journal entries to record the issuance of bonds : Dailey Company issued $655,500, 9%, 15-year bonds on December 31, 2013, for $629,280. Make the journal entries to record the issuance of bonds
What are the mechanisms that prevent acid base : What are the mechanisms that prevent acid- base imbalances from appearing in the body, and where each mechanism functions most significantly?
Describe the pressures that effect glomerular filtration : Describe the pressures that effect glomerular filtration and the effects of drinking too much beer on the urinary system?
What is the path of a spam cell from the site : What is the path of a spam cell from the site of its maturation site of the acrosomal reaction?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Which is a physical security measure

Which of the following is a physical security measure? A(n) ____ is an electronic audio file that is posted on the Web for users to download to their mobile devices or computers.

  What would be the representation 010 in 16-bit binary

Express 159 base10 and -98 base10 in 8-bit binary one's complement form and then add the numbers.

  Discuss four types of perceptual distortions

Discuss four types of perceptual distortions: stereotyping, halo effects, selective perception, and projection. Define each of these and provide an example.

  What is probability that it is actually raining in seattle

You are about to get on a plane to Seattle. Should you bring an umbrella? What is the probability that it is actually raining in Seattle?

  How do the servers and clients interact

Describe the characteristics of any commercial distributed system you have access to. What services are provided? How do the servers and clients interact?

  Estimate the average mass-transfer rate per unit

It is required to estimate the average mass-transfer rate per unit area of benzene evaporating from the outer surface of a circular cylinder across.

  Explain how to construct your network architectures

Explain how to construct your network architectures and how you trained them - explain how to construct your network architectures and how you trained them.

  Exemplify the predisposition towards web development

PHP and ASP are both well suited for web development. What are some of the features and capabilities that exemplify this predisposition towards web development? Are there any implementations for running client-side PHP.

  What is largest program that can be addressed by processors

What is the largest program that can be addressed by processors with the following number of address bits? The largest program is the same as the processor.

  Why are three-state gates used in an input interface

Describe the advantages of the open-collector gate over the three-state gate when the application entails multiple sources on a control signal.

  What is the expected time to find a key by exhaustive

Given a computer that can test 2^40 keys each second. What is the expected time to find a key by exhaustive search given a key space, say 2^88. How do you go about figuring this out? Is there a formula or standard equation that is used?

  Below are six questions select any five to answerwrite as

below are six questions select any five to answer.write as much as you need to answer the question a good answer is

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd