Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C/C++ program to simulate the Paging technique of memory management. Following steps should be implemented in the program: Ask the user to enter
Write a C/C++ program to simulate the Paging technique of memory management.
Following steps should be implemented in the program:
- Ask the user to enter memory size.
- Ask the user to enter page size.
- Display number of pages in memory according to the acquired data
- Ask the user to input the number of processes and pages required for each process.
- Enter the page table of each process.
- If enough memory is available, assign memory to each process otherwise display the message Memory is Full
- Compute and display the physical address of a memory address by asking the user to enter process number, page number, and offset.
- If the user inputs correct data, compute and display the corresponding physical address, otherwise display an error message,
The output of the program should be as follows:
saleha@ubuntu:-/Desktops gcc paging.c saleha@ubuntu:-/Desktop$ ./a.out Enter the memory size -- 1000 Enter the page size 100 10 The no. of pages available in memory are Enter number of processes -- 3 Enter no. of pages required for P[1]-- 4 Enter pagetable for P[1] 8 6 95 Enter no. of pages required for P[2] -- 5 Enter pagetable for P[2] --- 1 4 5 7 3 Enter no. of pages required for P[3]-- 5 Memory is Full Enter Logical Address to find Physical Address Enter process no. and pagenumber and offset -- 2 3 60 The Physical Address is 760saleha@ubuntu:-/Desktops |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