Virtual memory and paging – Disadvantages
Virtual memory is a technique that is used to manage memory usage in the event that a computing process requires more memory than is physically...
Question
Explain virtual memory mapping using paging. What are its disadvantages?
Answer
Virtual memory is a technique that is used to manage memory usage in the event that a computing process requires more memory than is physically available in the main memory of the system (the RAM). Virtual memory addresses are created to map onto either physical addresses within the main memory or, where this is not available, to a cache on the disk. These are done in the form of data structures called ‘page tables’. If the page table indicates that the entry is not stored in the main memory then a page fault exception is raised, which causes the operating system to take over and swap the relevant part of the cache into a free page frame on the main memory. This allows the system to continue functioning in lieu of sufficient RAM to handle all of its processes.
The obvious disadvantage to using virtual memory, and therefore to using disk caches as a supplement to main memory, is performance. The time it takes to read from a magnetic disk is significantly greater than the time it takes to access RAM, and therefore swapping should be avoided wherever performance is important. Solid state drives can improve speed of access a great deal, but unfortunately this type of memory is subject to wear after a certain number of writes. Constant paging to one of these drives is therefore likely to reduce its lifespan much more than normal usage would. An excessive rate of page faults puts the system into a state of ‘thrashing’ – constant swapping of data between memory and disk – which has a serious effect on application performance.