Menu

[Solved]Java 2d Array Recursion Explain Every Method Requested Write Java Program Simple Memory Ma Q37259713

java

2D array / recursion
explain every method

You are requested to write a Java program of a simpleMemory Management Unit.
The program should allow the following:
1. The user can create a process asking for memory. The programwill return a process ID if the requested memory can be allocated.It will also print the allocated Base and Limit.
2. The user can delete a process by specifying a process ID. Theprogram should do that and free any allocated memory for thedeleted process.
3. The user can, using a process ID, ask to convert between virtualaddresses and physical addresses.
4. The user can ask the program to print the memory map showingwhat memory is allocated and to which process.
Your program should be named mmu. When you start your program itprompts the user for the amount of memory to be managed inKB.
Your program should display a prompt for the user and should acceptthe following 4 commands:
1. cr AMOUNT_OF_REQUESTED_MEMORY
Description: Create a process and allocate the requested amount ofmemory (in KB) to it. The command should return the process ID andthe Base and Limit of the allocated memory. The command may returnan error message if there is not enough memory.
e.g. cr 1500
2. dl PROCESS_ID
Description: Delete the specified process and free the allocatedmemory. The command should return an error message if there is noprocess with the specified ID.
e.g. dl 6
3. cv PROCESS_ID VIRTUAL_ADDRESS
Description: Make a conversion for the specified process ID fromthe specified Virtual Address to the Physical Address. The commandshould return an error message if the process tries to access anaddress outside its address space.
e.g. cv 6 200
4.   pm
Description: Print the memory map. The command should print whichmemory locations are assigned.
e.g. pm

output

Enter amount of memory to be managed
10
         
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
cr 4
1 0 3
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
cr 8
No memory available for the amount you requested
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
cr 2
2 4 5
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
pm
1111110000
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
cv 2 1
5
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
dl 1
Enter:   cr AMOUNT_OF_REQUESTED_MEMORY
dl PROCESS_ID
cv PROCESS_ID VIRTUAL_ADDRESS
pm
Exit
pm
0000110000

Expert Answer


Answer to java 2D array / recursion explain every method You are requested to write a Java program of a simple Memory Management U… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *