Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I allocated ~24GB of my hard-drive as "virtual memory" -- what I understand to be extra space that the computer can use as RAM. My system has 8GB RAM built in, so my assumption is that I'm pumping a whopping ~32GB of available RAM.

virtual memory allocation

My question is, is that ~24GB of virtual memory less efficient than my built in RAM? And probably more importantly, what is the real difference between virtual memory and physical RAM?

share|improve this question
2  
How about speed difference? The HDD has moving physical parts so it has a lot of delays. And it has much more complicated path through your motherboard than RAM. –  Ashtray May 2 at 5:08
3  
Also, virtual memory has to be reloaded into real memory before it can be used. –  wendy.krieger May 2 at 5:44
    
I wonder, do you really need 30 gigs of memory? What kind of applications you are using? It's kind of bad if you're going out of real memory capacity. At least you could make use of SSD if you're going to do that as HDDs are REALLY slow –  Ashtray May 2 at 5:46
    
My assumption is that the computer using all available RAM first, by default. Before the virtual memory even gets a chance. Is that so? –  khaverim May 2 at 5:50
1  
The dialog box mentions "Paging file size" three times. It does not mention or ask for "virtual memory size" anywhere. The paging file is used by the virtual memory subsystem. So the box has the title "Virtual Memory" –  sawdust May 2 at 6:47

2 Answers 2

up vote 4 down vote accepted

The definition of Virtual Memory per the SU tag (which I wrote):

Virtual memory is a technique to provide more address space than the available physical memory (the installed RAM).
Each process can be given its own virtual memory, and the hardware (the Memory Management Unit, MMU) translates every virtual memory reference to a physical memory address.

To accommodate situations when more virtual memory is in use than actual physical memory, space on a storage device (the backing store, or swap space or page file) such as HDD, SSD or even thumb drive can be used to "swap out" memory data and later "swap (back) in" as needed.
The swapped memory data is usually in data lengths called pages, but there are alternate schemes that use variable length segments or even paged segments.

The dialog box you are showing is to configure the amount of disk space for the page file.
You are not allocating virtual memory. If you're using a 64-bit CPU and OS then there are 2**64 bytes of virtual memory per process.

Virtual memory has evolved from just a technique to provide more address space. Virtual memory is a key component in providing security to each process, so that a process cannot interfere with another process, not be compromised by another process.

ADDENDUM

A difficulty in describing Virtual Memory is that Microsoft has taken upon itself to re-invent the description of how VM actually works in Windows, and has published misleading explanations like this.
But the proper definition of Virtual Memory accepted by non-Microsoft OS developers and modern CPU designers, and how it actually works in computers is described in this computer architecture presentation.
VM is not a trivial topic, so apparently MS has twisted the explanation to describe the net benefits and the equivalent role of the paging file. Most unfortunately, MS has also chosen to occasionally refer to the paging file as "virtual memory", as if "Virtual Memory" actually resided external to the CPU and memory subsystem, which is contrary to what anyone learns in a computer architecture course and what Virtual Memory actually is.

Note that the MS Windows "explanation" of their Virtual Memory makes no mention of memory protection between processes. That omission is a clue that this explanation is bogus. The use of Virtual Memory is a crucial mechanism to ensure security in a computer, and to prevent one application program from breaking other programs or the whole PC. MS Windows does not use an alternate mechanism to isolate processes; it uses Virtual Memory with the provided MMU hardware just like other operating systems do.

ADDENDUM 2

Here' a Microsoft technical article that tries to use conventional memory management terms. The mapping of "virtual address spaces" to physical RAM is the salient operation of what the computer community knows as memory mapping of virtual memory.

A range of virtual addresses is sometimes called a range of virtual memory.

The insertion of "sometimes" is a bit strange, as if to acknowledge the conventional definition of "virtual memory" that the non-MS world uses and yet not contradict the MS (mis)use of this term.
Virtual addresses correspond to virtual memory, just like physical address correspond to physical memory.

share|improve this answer
    
What you're talking about is 'virtual addresses'. Virtual memory is in fact real, in that one can actually store that much data and refetch it. The fact that a process can address a 64-bit address does not equate to there being 16PB addressable core. –  wendy.krieger May 2 at 7:11
    
The definition in the first sentence, and the whole of the second para, supposes that gross usable memory = real + virtual memory, and that paging files or swap partitions are devices for effecting this. The fact that it is being swapped in and out of memory, tells us that it is real data. The sentence "Each process..." has nothing to do with virtual memory, since it remains true if swapping does not occur. All it means is that a memory manager keeps a translation table of process-address to real-address, and fetches one for the other. In the days of DOS, we called this protected memory. –  wendy.krieger May 2 at 7:30
    
The presentation shows that the virtual memory contains real data, and the OS is made to look like it has VM+mem available. The stuff about processes has nothing to do with extending real memory onto the hard disk, (VM), but about providing 'protected mode computing', where each process has a separate address-space. A memory manager provides page frames representing the program's address, but this can be done from real ram, and does not necessarily involve paging. –  wendy.krieger May 2 at 10:55

Virtual memory is where loaded but not current processes can be parked.

Programs in memory are ready to be used straight up. It's like having an open book on the desktop. Stuff that's in the swap file, is like having the book open at the right page, but sitting on the dresser behind you. It has to be brought to the desk first, before use.

Stuff that is not open is like being in the bookcase. You have to fetch the book and then open it to the right page.

Having more real memory is like having a bigger desk: more can get done straight up. Too much virtual memory can be a killer too, because what's open on the dressers etc, is managed on the desktop or real memory.

Speed is the main marker here.

Also, windos can only cope with a fixed memory size, esp 32 bit stuff So unless you're using win64, 4gb is well enough.

share|improve this answer
    
I'd like to add: do you think 8GB RAM / 22GB virtual is a good thing? Is there any reason I should lower the virtual memory? ( I have no concern for lost HD space) –  khaverim May 2 at 5:37
2  
If you have win32, you can only use 4gb, because that's all the OS knows. There is a ram disk that can use the other 4 in that case. If you have win64, the mix is quite usable as you have set it. It has more to do with what you run than the OS itself. –  wendy.krieger May 2 at 5:40
    
I have win64. I have a 750GB HD so I figured more is better if I'm going to use it for virtual memory. My gaming performance seems to have improved since I did it...so I like it so far. Thanks for your help. –  khaverim May 2 at 5:44
1  
It is better to allocate virtual memory as a single file to reduce fragmentation, but you already have done this. –  wendy.krieger May 2 at 5:45
1  
@wendy.krieger Better to say "32-bit" and "64-bit" - "win32" is the name of the Windows API in both 32-bit and 64-bit Windows. –  Bob May 2 at 6:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.