Question: Project 4-1 You will write a Java program that decomposes a virtual address into a page number and an offset within the page. Assignment: Write

 Project 4-1 You will write a Java program that decomposes a

Project 4-1 You will write a Java program that decomposes a virtual address into a page number and an offset within the page. Assignment: Write a Java program that prompts the user for the page size used in a virtual memory system; this will be a power of two between 512 (29) and 16384 (2"), inclusive. Your program should check the user input for page size to make sure it is one of the allowable inputs (must be a power of 2 and cannot be smaller than 512 or larger than 16384), and should then prompt the user for a virtual address (assume 32-bit virtual addressing, so your code must be able to accept any input between 0 and 4294967295, which is 22-1). Given this input, the program must output the virtual page number and the offset within the page. Sample output might look like this: Please enter the system page size: 1024 Please enter the virtual address: 10000 This address is in virtual page: At offset: 784

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!