Write a C program that emulates the logic of the memory management unit (MMU). The following are the requirements for th
Posted: Thu Jun 02, 2022 8:26 am
Write a C program that emulates the logic of the memory
management unit (MMU). The following are the requirements for the
program:
a.Prompt the user for a decimal number that will be used as the
page size. Valid page sizes can either be 4095 (4K bytes) or 8191
(8K bytes).
b.Display the page size to the console as a 16-bit binary number
that displays each binary digit as a 1 or 0 with the least
significant bit on the right side of the output. Also display the
page size to the console as a hexadecimal number.
c.Emulate a page table using a C array that supports the user
specified page table size (you may create C arrays to handle a page
table for both page sizes). The page table should represent a
virtual memory address space of 1M bytes (0x000FFFFF) with a system
that has a physical memory address size of 512K bytes (0x7FFFF),
which is located at 0x00000000 and 0x0007FFFF. Populate the page
table with the appropriate page table entries to support the
specified page
© 2021. Grand Canyon University. All Rights Reserved.
size and the physical memory address space. Page table entries
do not need to support page faults, caching, or other attributes of
a typical page able entry. The solution also does not need to
support a TLB.
d.Prompt the user for a hexadecimal virtual memory address
(between 0x00000000 and 0x000FFFFF), which will be converted to a
physical memory address. Display to the console the input virtual
memory address as a hexadecimal number.
e.Convert the virtual memory address to a physical memory
address using the user specified page size and a populated page
table. Display to the console the resultant physical memory address
as a hexadecimal number. If the virtual memory address does not fit
into the physical memory address simply display that the result is
"Currently On Disk."
f.Run the program with at least 10 different virtual memory
addresses to validate all functionality of your program, including
addresses that can be mapped to physical memory and some that are
on disk. Make sure you write your program in a modular fashion to
eliminate redundant code
management unit (MMU). The following are the requirements for the
program:
a.Prompt the user for a decimal number that will be used as the
page size. Valid page sizes can either be 4095 (4K bytes) or 8191
(8K bytes).
b.Display the page size to the console as a 16-bit binary number
that displays each binary digit as a 1 or 0 with the least
significant bit on the right side of the output. Also display the
page size to the console as a hexadecimal number.
c.Emulate a page table using a C array that supports the user
specified page table size (you may create C arrays to handle a page
table for both page sizes). The page table should represent a
virtual memory address space of 1M bytes (0x000FFFFF) with a system
that has a physical memory address size of 512K bytes (0x7FFFF),
which is located at 0x00000000 and 0x0007FFFF. Populate the page
table with the appropriate page table entries to support the
specified page
© 2021. Grand Canyon University. All Rights Reserved.
size and the physical memory address space. Page table entries
do not need to support page faults, caching, or other attributes of
a typical page able entry. The solution also does not need to
support a TLB.
d.Prompt the user for a hexadecimal virtual memory address
(between 0x00000000 and 0x000FFFFF), which will be converted to a
physical memory address. Display to the console the input virtual
memory address as a hexadecimal number.
e.Convert the virtual memory address to a physical memory
address using the user specified page size and a populated page
table. Display to the console the resultant physical memory address
as a hexadecimal number. If the virtual memory address does not fit
into the physical memory address simply display that the result is
"Currently On Disk."
f.Run the program with at least 10 different virtual memory
addresses to validate all functionality of your program, including
addresses that can be mapped to physical memory and some that are
on disk. Make sure you write your program in a modular fashion to
eliminate redundant code