Shown below is a very small memory system There are just 8 b

Shown below is a very small memory system. There are just 8 bytes of main memory and 16 bytes of virtual memory. A page is just 2 bytes long. The virtual address is just 4 bits and has a page and offset portion. An example is shown. Likewise the physical address is 3 bits long and has a page and an offset. Answer the following questions: A program runs and needs the following addresses in sequence 0, 1, 2, 3, 6, 7, 10, 11. Use the page table shown to fill in the data that will be in main memory when the program finishes with address 11. Draw a circle around those addresses in the sequence that cause a page fault. 0, 1, 2, 3, 6, 7, 10, 11

Solution

irtual Memory

Virtual Memory is a space where large programs can store themselves in form of pages while their execution and only the required pages or portions of processes are loaded into the main memory. This technique is useful as large virtual memory is provided for user programs when a very small physical memory is there.

In real scenarios, most processes never need all their pages at once, for following reasons :

Benefits of having Virtual Memory :

ially only those pages are loaded which will be required the process immediately.

The pages that are not moved into the memory, are marked as invalid in the page table. For an invalid entry the rest of the table is empty. In case of pages that are loaded in the memory, they are marked as valid along with the information about where to find the swapped out page.

When the process requires any of the page that is not loaded into the memory, a page fault trap is triggered and following steps are followed,

There are cases when no pages are loaded into the memory initially, pages are only loaded when demanded by the process by generating page faults. This is called Pure Demand Paging.

The only major issue with Demand Paging is, after a new page is loaded, the process starts execution from the beginning. Its is not a big issue for small programs, but for larger programs it affects performance drastically.

 Shown below is a very small memory system. There are just 8 bytes of main memory and 16 bytes of virtual memory. A page is just 2 bytes long. The virtual addre

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site