HOW TO ADJUST OR INCREASE VIRTUAL MEMORY IN WINDOWS OS
Virtual Memory Definition
Virtual memory is a section of volatile memory created temporarily on the storage drive. It is created when a computer is running many processes at once and Ram is running low.
The operating system makes part of the storage drive available to use as RAM. Virtual memory is much slower than main memory because processing power is being taken up by moving data around, rather than just executing instructions. The guide on operating system explains how the OS manages memory.
Latency is increased when the computer needs to use virtual memory.
Swapping is the process the OS uses to move data between RAM and virtual memory. The OS moves data from processes that are not immediately needed out of the RAM and stores them in virtual memory. It copies the data back into RAM when the process is needed again.
Using virtual memory slows the computer down because copying to a hard disk takes much longer than reading and writing RAM.
Types of virtual memory: Paging and Segmentation
Virtual memory can be managed in a number of different ways by a system’s operating system, and the two most common approaches are paging and segmentation.
Virtual Memory Paging
In a system which uses paging, RAM is divided into a number of blocks – usually 4k in size – called pages. Processes are then allocated just enough pages to meet their memory requirements. That means that there will always be a small amount of memory wasted, except in the unusual case where a process requires exactly a whole number of pages.
During the normal course of operations, pages (i.e. memory blocks of 4K in size) are swapped between RAM and a page file, which represents the virtual memory.
Virtual Memory Segmentation
Segmentation is an alternative approach to memory management, where instead of pages of a fixed size, processes are allocated segments of differing length to exactly meet their requirements. That means that unlike in a paged system, no memory is wasted in a segment.
Segmentation also allows applications to be split up into logically independent address spaces, which can make them easier to share, and more secure.
But a problem with segmentation is that because each segment is a different length, it can lead to memory “fragmentation.” This means that as segments are allocated and de-allocated, small chunks of memory can be left scattered around which are too small to be useful.
As these small chunks build up, fewer and fewer segments of useful size can be allocated. And if the OS does start using these small segments then there are a huge number to keep track of, and each process will need to use many different segments, which is inefficient and can reduce performance.
Virtual Memory Characteristics
The virtual memory mechanism works by making use of both hardware and software. Virtual memory carries out its job by mapping memory address used by a program, which is referred to as virtual addresses, into a physical address in the computer memory.
With that in mind, all memory references are initially logical addresses that will be dynamically translated into a physical address at run time. The benefit of this is that the process can be swapped in and out of main memory, this allows it to occupy different places in the main memory at different times during the course of execution.
The process, which is getting executed, may be broken into a number of different pieces and these pieces cannot be continuously located in the main memory during execution. This is allowed due to the combination of dynamic run time address translation and the use of page or segment tables.
Dynamic address translation: This is a process of translating a virtual address during a storage reference into the corresponding real address.
Virtual memory is implemented using both Demand Paging and Demand Segmentation.
Demand paging is a type of swapping that is done in virtual memory systems. Demand paging as it says from the title, only copies data from the disk to the RAM if the data is required by some program, therefore meaning that the data will not be when the data is already available on the memory. This can be referred to as “lazy evaluation”, because only the demanded pages of memory are being swapped from the secondary storage (disk space) to the main memory.
Another type of paging which virtual memory uses is Anticipatory Paging, this is when the operating system attempts to anticipate data that will be needed next and copies it to the RAM before it is actually required.
The process of Demand paging occurs like so:
Page table: A page table is the data structure used by a virtual memory system in a computer operating system to store the mapping between visual address and physical addresses.
- The CPU generates an interrupt indicating memory access fault if the CPU tries to refer a page that is currently not available in the main memory.
- The operating systems places the interrupted process in a blocking state. Though for the execution to proceed, the operating system must bring the required page into the memory.
- The operating system will search for the required page in the logical address space.
- The page that is required will be brought to the physical address from the logical address. Page replacement algorithms are used for the decision making of replacing the page in physical address space.
- The page table will be updated accordingly.
- A signal will then be sent to the CPU to continue the election of the program and it will place the process back into the ready state.
Therefore, whenever a page fault occurs, the steps above are followed by the operating system and the required page is brought back into memory.
Advantages and Disadvantages of Virtual Memory
Even though RAM is now relatively inexpensive compared to its cost when virtual memory was first developed, it is still extremely useful and it is still employed in many, perhaps most, computer systems. The key problem with virtual memory relates to performance.
Advantages of Virtual Memory
- Allows more applications to be run at the same time.
- Allows larger applications to run in systems that do not have enough physical RAM alone to run them.
- Provides a way to increase memory which is less costly than buying more RAM.
- Provides a way to increase memory in a system which has the maximum amount of RAM that its hardware and operating system can support.
Disadvantages of Virtual Memory
- Does not offer the same performance as RAM.
- Can negatively affect the overall performance of a system.
- Takes up storage space which could otherwise be used for long term data storage.
Increasing Or Adjusting Virtual Memory in Windows 10
- Go to the Start Menu and click on Settings.
- Type performance.
- Choose Adjust the appearance and performance of Windows.
- In the new window, go to the Advanced tab and under the Virtual memory section, click on Change.
- At the bottom of the new window, check what the Recommended value is and how it compares to Currently allocated.
- If the current setting is significantly less than the recommended, uncheck the Automatically manage paging file size for all drives box at the top of the same windows and then click on Custom size.
- Enter the Recommended value in the Initial Size box, and a larger figure in the Maximum size box.
- Click OK to save the new settings.
Drop your comment