270 likes | 459 Views
What's Virtual Memory?. Virtual memory is a combination of RAM (physical system memory) and reserved hard disk space. The word virtual means "appearing to exist, but not really there.". Virtual memory vs. physical memory. During the execution of a program, parts of the program are in physical RA
E N D
1. Virtual Memory Lei Li
CS147
2. What’s Virtual Memory? Virtual memory is a combination of RAM (physical system memory) and reserved hard disk space.
The word virtual means "appearing to exist, but not really there."
3. Virtual memory vs. physical memory
During the execution of a program, parts of the program are in physical RAM and other parts are swapped out to the hard disk.
Virtual Memory = RAM + hard disk
Why is VM important?
Cheap no longer have to buy lots of RAM
Removes burden of memory resource management from the programmer
Other benefits
4. Virtual memory > RAM Because virtual memory is a combination of RAM and hard disk space, it's possible to have more virtual memory in your system than you have RAM installed.
Because Windows uses virtual memory to run programs, it's possible to run more applications simultaneously than would be possible if Windows used only physical memory to run programs.
5. Virtual memory
6. The memory pyramid
7. How Does VM Work ? Two memory “spaces”
Virtual memory space what the program “sees”
Physical memory space what the program runs in (size of RAM)
On program startup
OS copies program into RAM
If there is not enough RAM, OS stops copying program and starts it running with only a portion of the program loaded in RAM
When the program touches a part of the program not in physical memory (RAM), OS catches the memory abort (called a page fault) and copies that part of the program from disk into RAM
In order to copy some of the program from disk to RAM, OS must evict parts of the program already in RAM
OS copies the evicted parts of the program back to disk
8. Example: Virtual and Physical Address Spaces Virtual Address Space Physical Address Space
9. Example (con'td): Need VAtoPA mappings
10. Example (con'td): After handling a page fault
11. Example (con'td): After a second page fault
12. Basic VM Algorithm Program asks for virtual address
Computer translates virtual address (VA) to physical address (PA)
Computer reads PA from RAM, returning it to program
13. Page Tables Table which holds VA > PA translations is called the page table
In our current scheme, each word is translated from a virtual address to a physical address
How big is the page table?
14. Real Page Tables Instead of the finegrained VM where any virtual word can map to any RAM word location, partition memory into chunks called pages
Typical page size today is 4 or 8 KBytes
This reduces the number of VA> PA translation entries
Only one translation per page
For a 4 KByte page, that's one VA> PA translation for every 1,024 words
Within a page, the virtual address == physical address
15. How Can I Find Out How Much Virtual Memory My System Has? Windows can tell you the amount of virtual memory available at any given time and the percentage of your total system resources that are currently available for applications.
To get this information, switch to Program Manager, and choose Help/About Program Manager.... At the bottom of the display box, your free memory (virtual memory) and % of free resources are listed. The amount of free memory should be 12 megabytes or more, i.e., 12,000 KB. It is also recommended that your % free be as high as possible.
16. My system virtual memory
19. What Causes Free Memory to Decrease? Every time you run an application program under Windows, that program uses some of your free virtual memory to run program code, and to store and display data. Programs use additional memory as they:
open new documents
execute utility programs (like a spell-checker)
perform other related program operations
20. Optimizing Memory for Use with Windows* optimize your use of existing memory so that the maximum possible amount is available for Windows to access directly:
1, close down some (or all) applications that are running in the background or running minimized.
-------In some cases, you'll need to close and restart Windows to achieve the maximum available virtual memory your system can have. (This is because some applications don't de-allocate memory after they're closed.)
21. Optimizing Memory for Use with Windows* (con)
2, unload memory-resident programs and drivers that load into conventional or extended memory.
Note: address range in the system memory
Conventional memory: 0-640K
upper memory: 640K-1M
Extended memory: above 1M.
22. Optimizing Memory for Use with Windows* (con) Since Windows* can access extended memory directly, and since extended memory is normally available in the largest quantities, freeing up extended memory is usually the most efficient way to gain virtual memory for Windows to use.
To free up extended memory, check your system for RAM disks or disk caches that are created from extended memory. Eliminating these or reducing their size will provide more virtual memory for Windows applications.
23. Increasing the Amount of Virtual Memory in the System Besides optimizing the system memory, we can also increase the amount of virtual memory in the system.
There are two ways:
--------Increase the amount of system RAM available.
--------Create a permanent or temporary swap file.
24. Increasing the Amount of Virtual Memory in the System(cont) To increase available system RAM, purchase additional memory chips and install them in your computer.
To increase the amount of hard disk space allocated as virtual memory, you need to create a Windows swap file, or increase the size of your current Windows swap file.
25. How to Create, Delete, or Change the Size of a Swap File Open the Windows Control Panel by double clicking the 'Control Panel' icon(usually located in Windows' 'Main' program group).
Double-Click on the 386 Enhanced icon in the Control Panel window.
Click on Virtual Memory.
Click on Change.
In the 'New Settings' box, select Permanent or Temporary (See: Permanent Swap Files) from the 'Type' box. Select 'None' to delete an existing swap file.
Enter a size in the 'New Size' box.(Skip this step when deleting a swap file).
Click on OK.
Click on Yes to tell Windows you're sure about making changes to virtual memory.
Click on OK to confirm the message that the swap file has been created.
Restart Windows when prompted.
26. For more information, please go to
www.intel.com
and search on virtual memory