Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please this has to written in Java, Thanks. I do leave great feed backs if code run smoothly. virtual.txt 1441 1fb9 1629 14e3 1f7b 1a2c
Please this has to written in Java, Thanks. I do leave great feed backs if code run smoothly.
virtual.txt 1441 1fb9 1629 14e3 1f7b 1a2c 141a 20bd 1945 14b9 1fcb 1844 14ed 2068 186f 1673 202a 1838 12e4 20ec 196a 109c 1d4b 1272 1505 1e61 189b 1038 1ee0 1594 1318 21ee 158c 1094 1f5b 1777 15d7 1f03 1843 127c 2254 11f7 12ff 1dec 16a1 1621 2187 171d 134e 212f 1682 16a9 1f26 13fa 14c3 220b 1544 1351 1fd9 1573 1727 2015 16ca 1120 2190 16c3 134c 20de 144b 137c 216a 1617 156b 209c 17a0 1436 1d21 1782 10fb 21da 159a 12b2 2096 1880 1642 2001 143b 1381 203e 1711 136f 1f56 176d 1246 1f54 156c 1202 220f 1861 1287 23ef 153e 11c6 1f45 1672 1436 2116 1861 1126 20c6 1a45 118b 1f71 1679 1229 2108 1698 117c 2121 1820 1338 1fac 1894 150e 1ff6 1714 12ef 212c 1802 10ce 1a76 1785 dc2 2007 18f4 1433 2048 148e 1125 1fd4 1961 1080 1dc6 1825 149d 1f16 192e 13a3 1f5c 10b7 17aa 1e4f 1ab1 100a 200b 151a 13ea 1f15 12af 1259 1e93 18a3 18e2 1efb 17de 1718 1fa1 16cd 10bd 2156 18e0 1564 2249 1ac5 1849 1dce 173e 116e 1f9a 1700 1320 1ff0 1594 152e 1f96 1815 1197 1ecd 1456 117f 21ed 1469 ecb 1d55 1503 1155 203a 18a8 1247 1faa 176f 14cc 2157 174e 15eb 202f 1796 138d 21cb 181fCreate 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. Virtual Memory - page Table:FrameEntry[] - Fifo Queue: Queue +Virtual Memory + physicalAddress(virtualAddress: int): int Queue FrameEntry - FrameNumber: int - ValidBit: boolean - pages: int[] - nextIn: int - nextOut: int - size:int - count: int + FrameEntry + setFrame(frame:int) : void + getFrame(): int + setValid(valid: boolean): void + getValido: boolean + Queue (queueSize: int) + addPage(pageNumber: int) : void + removePage: int + isEmpty(): boolean + is FullO:boolean + getCount : int Upload: Your Java source file (java) Sample Output Last few lines of console output for provided virtual.txt Page Fault: Page if loaded in frame 4 replaces page le Page ult: Page 17 loaded in frame 5 repl ces page 14 Page Fault: Page 14 loaded in frame 6 repl ces page 21 Page Fault: Page 21 loaded in frame 7 repl ces page e Page Fault: Page 15 loaded in frame 0 repl ces page id Page Fault: Page 13 loaded in frame i repl ces page 11 Page Fault: Page 18 loaded in frame 2 re ces page 20 File physical.txt closed Hit ratio: 0.49047619047619045 DUDU PUDDDD 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. Virtual Memory - page Table:FrameEntry[] - Fifo Queue: Queue +Virtual Memory + physicalAddress(virtualAddress: int): int Queue FrameEntry - FrameNumber: int - ValidBit: boolean - pages: int[] - nextIn: int - nextOut: int - size:int - count: int + FrameEntry + setFrame(frame:int) : void + getFrame(): int + setValid(valid: boolean): void + getValido: boolean + Queue (queueSize: int) + addPage(pageNumber: int) : void + removePage: int + isEmpty(): boolean + is FullO:boolean + getCount : int Upload: Your Java source file (java) Sample Output Last few lines of console output for provided virtual.txt Page Fault: Page if loaded in frame 4 replaces page le Page ult: Page 17 loaded in frame 5 repl ces page 14 Page Fault: Page 14 loaded in frame 6 repl ces page 21 Page Fault: Page 21 loaded in frame 7 repl ces page e Page Fault: Page 15 loaded in frame 0 repl ces page id Page Fault: Page 13 loaded in frame i repl ces page 11 Page Fault: Page 18 loaded in frame 2 re ces page 20 File physical.txt closed Hit ratio: 0.49047619047619045 DUDU PUDDDD
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started