Question: USE C IN A LINUX BASED SYSTEM AND DON'T USE CHATGPT Write a program to simulate the process of address translation using a two level
USE C IN A LINUX BASED SYSTEM AND DON'T USE CHATGPT
Write a program to simulate the process of address translation using a two level
page table with a page directory for virtual memory management.
Design :
Implement a twolevel page table structure. The first level is a Page Directory
PD which points to the Page Tables.
Assume that a virtual address is divided into three parts
Page Directory Index bits: Top level index that maps to an entry in the
Page Directory.
Page Table Index bits: Second level index that maps to an entry in the
page table.
Offset bits: Offset within the actual page
Use the following configuration
Virtual Address Length: bit Eg : xCCCFFEE
Page Size: KB
Page Table Entries: Each page table has entries each entry is of
B
Address Translation:
Implement an API consisting of two functions, load and store with the
following signature as shown below.
uintt loaduintt va
assert && TODO : SIMULATE READING FROM va;
void storeuintt va
assert && TODO : SIMULATE WRITING INTO va;
xx Implement these functions to simulate memory access. If the address can
be successfully translated to a physical address, then loadstore the value
into the physical address. If the address cannot be translated ie PD or
Page Table Entry is invalid null simulate a page fault and update the PD
and Page Tables accordingly.
Deliverables:
Hook into your load and store APIs to track and display the total number of page
hits and page misses.
The page table and the page directory size.
For page misses, show the updates made to the PD and Page Table.
Provide a summary at the end showing the hitmiss ratio.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
