Question
Objective: -In C translate a virtual address to a physical address, involving a custom-sized fully associative page table. Inputs: -The total size of physical memory
Objective:
-In C translate a virtual address to a physical address, involving a custom-sized fully associative page table.
Inputs:
-The total size of physical memory (in words)
-The page size (words/page)
-The replacement policy (LRU, FIFO)
Outputs:
-The corresponding physical address for a virtual address A message indicating a page fault (if any) in the page table
Specification:
-The program translates a virtual address to a physical address based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are:
a) Set parameters
b) Map virtual address
c) Quit program
-Upon entering the parameters, the page table is to be dynamically allocated based on the total number of page frames. The virtual pages will be mapped to the page frames on demand in the page frame order 0,1,2,3,
--------------------------------------------------------------------------------
TEST RUN EXMPLE
Use below to test the program, yours should run exactly the same and have same outputs
--------------------------------------------------------------------------------
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit
Enter selection: a
Enter main memory size (words): 2048
Enter page size (words/page): 1024
Enter replacement policy (0=LRU, 1=FIFO): 0
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit
Enter selection: b
Enter virtual memory address to access: 5000
Page fault!
-----------------
| VP | PF |
-----------------
| 4 | 0 |
-----------------
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit
Enter selection: b
Enter virtual memory address to access: 2048
Page fault!
-----------------
| VP | PF |
-----------------
| 4 | 0 |
-----------------
| 2 | 1 |
-----------------
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit Enter selection:
b Enter virtual memory address to access: 4509
Virtual address 4509 maps to physical address 413
-----------------
| VP | PF |
-----------------
| 2 | 1 |
-----------------
| 4 | 0 |
-----------------
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit Enter selection: b
Enter virtual memory address to access: 7160
Page fault!
-----------------
| VP | PF |
-----------------
| 4 | 0 |
-----------------
| 6 | 1 |
-----------------
-------------------------------------------------------
Virtual memory to Main memory mapping:
-------------------------------------------------------
a) Enter parameters
b) Map virtual address
c) Quit
Enter selection: c
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