lab assignment 6

profileUkoirala
Lab6.pdf

© Paul Koester, Dallas County Community College, 2018

COSC 2425 – Computer Organization

Lab #6 – Virtual Memory

Create a Java program which translates a virtual address to a physical address for a hypothetical

computer. The input is a text file with a list of 16-bit virtual addresses in Hexadecimal. The output is a

text file with the corresponding physical addresses. Each page fault will also result in a message to the

console. This computer is byte-addressable with 16-bit virtual addresses, 2KB of physical memory, and

a 256 byte page size. It uses a FIFO page replacement policy.

Requirements

1. The program must be written in Java.

2. It reads Hexidecimal address from the virtual.txt file and writes physical addresses to the

physical.txt file.

3. When a page is not in physical memory. A page fault occurs. The program must display a

message to the console indicating which page (if any) was swapped out of physical memory and

which physical memory frame the new page was loaded into.

4. To implement the FIFO page replacement policy a queue is required. You may implement the

queue yourself or use the one provided by the Java API.

Hint: The UML Class diagram below describes one way to organize the program.

Extra Credit (up to 10 points)

In addition to using the FIFO replacement policy, run the same data using an LRU policy. Calculate and

display the hit ration for that.

© Paul Koester, Dallas County Community College, 2018

Upload: Your Java source file (.java)

Sample Output

Last few lines of console output for provided virtual.txt

Page Fault: Page 1f loaded in frame 4 replaces page 1e

Page Fault: Page 17 loaded in frame 5 replaces page 14

Page Fault: Page 14 loaded in frame 6 replaces page 21

Page Fault: Page 21 loaded in frame 7 replaces page e

Page Fault: Page 15 loaded in frame 0 replaces page 1d

Page Fault: Page 13 loaded in frame 1 replaces page 11

Page Fault: Page 18 loaded in frame 2 replaces page 20

File physical.txt closed

Hit ratio: 0.49047619047619045