Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solutions to each of the 2 problems (2 separate programs) should be submitted via D2L. All solutions are to be written in C. 1. This
Solutions to each of the 2 problems (2 separate programs) should be submitted via D2L. All solutions are to be written in C. 1. This question consists of writing a program that translates logical to physical addresses for a virtual address space of size 65,535 bytes. Your program wil read from stdin a list of logical addresses, translate each logical address to a physical address and then print the value at that address. The goal is to simulate the steps involved in translating logical to physical addresses Design your simulation with the follow ing parameters Therefore, the page table has 2 entries. You can use a simple array to implement * Your process has been allocated n frames. n is a parameter to your program on the A page is 2-256 bytes. (Note, this means a frame is also 2"in size) this table command line For the address translation you are to use the simple single level of page table mapping (page table is 8 bits, page offset is 8 bits) Page table Page offset I have provided a sample file memory.txt that contains the contents of the processes memory. This memory file is the second parameter to your program. When you page "in" you must load the frame with the contents of the page from this file. You can use fopen (), fread(), fseek() and fclose() to manage the file to get the data. Your program should print for each logical address read Logical address -> physical address -> char (where char is the character read at that logical address). It should also keep track of the number of page faults that occur and print the statistic at the end. Notes * Running your program with the sample file can be done as: ./a.out 10 memory.txt
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