Why is virtual memory important




















To understand how virtual memory works we have to go back in time, before virtual memory even exited. As we know, the system itself is using a portion of RAM.

If we run more applications, each application will also get its own portion of RAM. If we run too many applications, at one point we will run out of RAM. Back in those days we had to live with that. Everything changed with the release of Windows 3. With these two together we could use virtual memory. To do that, a portion of the hard drive is reserved by the system. That portion can be either a file or a separate partition.

In the case of Windows it is a file called pagefile. Under Linux a separate partition is used for memory. That means that we can run more applications than we have RAM installed. As far as the CPU is concerned there is enough memory to accommodate all applications.

In Windows we can manage virtual memory through the Advanced tab of the System applet in Control Panel. Windows manages the virtual memory settings automatically, which should be sufficient in most cases. However, we can also manually configure the maximum size of the virtual memory swap file and the disk partition on which the swap file is stored.

The recommended size for the swap file is 1. For a slight increase in performance, we can move the swap file to a different physical disk than is being used by the operating system. However, if the paging file is on the system drive, Windows creates a memory dump file if the system crashes. This file can be used to help identify what caused the system crash.

With virtual memory we also use a process called swapping. The process of moving data from RAM to disk and back is known as swapping or paging. As we know, hard drive is a lot slower than RAM. In other words, the system will take the application that is currently being used, which is MS Word in our case, and will load all of it into RAM. When we need to use MS Excel again and we switch to it, the system will take MS Word memory requirements and put it back onto the hard disk drive, and will take MS Excel memory requirements out of the paging file and load it back into physical RAM.

That makes sure that the currently active application is running in physical RAM, which allows us to have reasonably good performance. Then it will take the the application currently being accessed back to the physical RAM. The process of taking an application from the physical RAM and putting it in the page file is called paging out. This method helps OS to find page usage over a short period of time.

This algorithm should be implemented by associating a counter with an even- page. Fault rate is a frequency with which a designed system or component fails. It is expressed in failures per unit of time. It is denoted by the Greek letter? Skip to content. Report a Bug. Previous Prev. Next Continue. Home Testing Expand child menu Expand. Second, it allows us to have memory protection, because each virtual address is translated to a physical address. Following are the situations, when entire program is not required to be loaded fully in main memory.

User written error handling routines are used only when an error occurred in the data or computation. Many tables are assigned a fixed amount of address space even though only a small amount of the table is actually used. Each user program could take less physical memory, more programs could be run the same time, with a corresponding increase in CPU utilization and throughput. Modern microprocessors intended for general-purpose use, a memory management unit, or MMU, is built into the hardware.

The MMU's job is to translate virtual addresses into physical addresses. Virtual memory is commonly implemented by demand paging. It can also be implemented in a segmentation system. Demand segmentation can also be used to provide virtual memory. A demand paging system is quite similar to a paging system with swapping where processes reside in secondary memory and pages are loaded only on demand, not in advance.

While executing a program, if the program references a page which is not available in the main memory because it was swapped out a little ago, the processor treats this invalid memory reference as a page fault and transfers control from the program to the operating system to demand the page back into the memory. Number of tables and the amount of processor overhead for handling page interrupts are greater than in the case of the simple paged management techniques.



0コメント

  • 1000 / 1000