Question: Please help me with this lab. TIA! Create a Java program which translates a virtual address to a physical address for a hypothetical computer. The
Please help me with this lab. TIA!


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. 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. 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 3. 4. 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 VirtualMemory pageTable: FrameEntry] FifoQueue: Queue + VirtualMemory0 + physicalAddress(virtualAddress: int): int Queue FrameEntry - FrameNumber: int - ValidBit: boolean pages: int[] - nextIn: int - nextOut: int size: int - count: int +FrameEntry0 + setFrame(frame: int): void + getFrame: int + setValid(valid: boolean): void +getValid0: boolean + Queue(queueSize: int) + addPage(pageNumber: int): void + removePage0: int + isEmpty: boolear + isFullO: boolean + getCount): int Upload: Your Java source file (.java) Sample Output Last few lines of console output for provided virtual.txt Page Fault: Page lf loaded in frame 4 replaces page le 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 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. 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. 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 3. 4. 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 VirtualMemory pageTable: FrameEntry] FifoQueue: Queue + VirtualMemory0 + physicalAddress(virtualAddress: int): int Queue FrameEntry - FrameNumber: int - ValidBit: boolean pages: int[] - nextIn: int - nextOut: int size: int - count: int +FrameEntry0 + setFrame(frame: int): void + getFrame: int + setValid(valid: boolean): void +getValid0: boolean + Queue(queueSize: int) + addPage(pageNumber: int): void + removePage0: int + isEmpty: boolear + isFullO: boolean + getCount): int Upload: Your Java source file (.java) Sample Output Last few lines of console output for provided virtual.txt Page Fault: Page lf loaded in frame 4 replaces page le 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
