Moving the pagefile to RAM is a ridiculous notion Just turn it off and by more RAM. :)
No matter how much RAM you have, you want the system to be able to use it efficiently. Having no paging file at all forces the operating system to use RAM inefficiently for two reasons. First, it can't make pages discardable, even if they haven't been either accessed or modified in a very long time, which forces the disk cache to be smaller. Second, it has to reserve physical RAM to back allocations that are very unlikely to ever require it (for example, a private, modifiable file mapping), leading to a case where you can have plenty of free physical RAM and yet allocations are refused to avoid overcommitting.
Consider, for example, if a program makes a writable, private memory mapping of a 4GB file. The OS has to reserve 4GB of RAM for this mapping, because the program could conceivably modify every byte and there's no place but RAM to store it. So immediately, 4GB of RAM is basically wasted (it can be used to cache clean disk pages, but that's about it).
Memory Management is handled by the CPU and whether the pagefile is on or off makes not one iota of difference to how pages are treated. It's transparent to Windows.
The page priority doesn't change, pages will be discarded just the same. Pagefiles are used by the CPU as secondary storage, not the OS. It's nothing more than level two cache fwhen level one (RAM) runs out.
A quick and very dirty example:, my machine has 16GB of RAM and no pagefile. 5 mins ago with 13GB in standby and only 2GB free, I loaded Fallout 4.
The low priority pages were discarded as Fallout loaded.
Btw on a side note, the 2008 Technet Blog on Pushing Windows Memory Limits is very misleading - I would say to the point of deception.
https://i.stack.imgur.com/wXkmi.png
I'm dubious as too whether even Mark wrote it, but I hope not, as it would change my perspective of him.....
Fwiw there are gaping holes in the article which I'm dumfounded no one has picked on considering how often that blog has been refer
- The pagefile and it's location are handled by Windows, the trapping of memory access to locations that have been paged out to disk would be caught by the CPU, but handed to the operating system to retrieve the page from disk and load it in.
Anyway here is one not so vague description:
Windows cannot reach higher addresses than the CPU - it's not possible.
No matter what the OS is capable of it still limited by the hardware it runs on.. because the OS is actually the CPU itself (internal registers).
OK, so pagefile is an area on the HDD which the CPU uses for extended physical address space when it can't physically or architecturally use more RAM.
On segmented x86 32bit architecture for example there are two 2GB segments of RAM.
One is allocated to the kernel. The other 2GB is for user mode.
That's all the RAM the CPU can use with 32 DRAM pins, but a 32bit process has 4GB available so what to do. Well luckily the CPU can use secondary storage AKA the hard drive for storing the extra 2GB of pages. Because it has internal registers
The physical locations where virtual pages referenced by the process don't have to be stored in RAM. But they do have be stored somewhere by the CPU.
The CPU can't give all 4GB RAM to the app, but it can give it 4GB of address by using the HDD as secondary cache (which is all the HDD really is)
The pages are moved in and out of RAM through it's internal paging mechanism, but this is not the same as a pagefile. Paging always occurs....
The bottom line is really not that complicated. For the last 15 or so years many end users have been given the impression a pagefile is some integral part of the Operating System, it is not. It never has been. This misconception is partly fuelled by corporations like Intel and Microsoft.
RAM is a fast storage device, the Hard Drive is a slower storage device, so essentially RAM is level 1 cache, the Hard Drive is Level 2 (disregarding CPU cache for this analogy). Both can be accessed by the CPU.
If not enough RAM is available for the CPU to store the pages it needs to, the HDD can be used as an overflow. If there is plenty of RAM, then the PF is redundant.
Up until Core 2, Intel processors had a 32pin DRAM bus, and 32 registers meaning the CPU had access to 4GB of RAM, and 4GB of HDD space (pagefile). This is an architectural hardware limitation, not a Windows limitation.
The total available for processes was 3.5GB, because a page table takes up 512MB. Which is why 3.5GB shows up in Windows with Intel CPU's (up until Core 2). Add a GPU and even less is available.
Xeon could access a total of 32GB RAM, 64GB of Physical Space with HDD included (pagefile again). (This ^ covers PAE,-more to come with links added).
http://www.windowsdevcenter.com/pub/a/windows/2004/04/27/pagefile.html
![enter image description here](../../I/static/images/61821fca7b8f13c4c9ab756d5b910507baf783fade443cc447d211472ae2b1ee.png)
![enter image description here](../../I/static/images/acddf44b5899842872eb0a2c649a13833c3bca9d6d2424a93a6dd43ca4ef6124.png)
3rd screenshot source:
System V Application Binary Interface
AMD64 Architecture Processor Supplement Draft Version 0.99.7
I intend to continue improving this answer and adding source material and relevant info. I'd like to achieve a balance between not enough information and too much technical information.
Suggestions are welcomed. Please don't downvote just because it may not be written so well.
57Having a paging file on a RAM disk never accomplishes anything. You take away a certain amount of available memory and add a certain amount of virtual memory. Null-sum. Just have no paging file. – usr – 2014-09-11T14:47:51.630
14
In makes some sense to do this on Linux in some cases where the ram disk hosting the swap file is actually compressed. See: http://en.wikipedia.org/wiki/Zram. However I don't think Windows has such a feature available to it.
– Matt H – 2014-09-11T21:10:57.7332The answer is yes but there are plenty of nonbelievers. – user541686 – 2014-09-12T06:18:39.940
14@user367257 creating a ram disk to store your page file on is like lending your friend £10 so that he has enough money to allow you to borrow £10 from him. It might be technically possible but all you've accomplished is to needlessly complicate a journey to nowhere. – Rob Moir – 2014-09-12T22:07:44.707
2I would (and do) only turn it off for an SSD, since you only get so many writes (even if it’s a lot now), with 6GB. It works well. – Ry- – 2014-09-13T02:24:02.793
1memory management and pagefile/swapfile management have changed radically over kernel versions and will continue to change radically. please state in your answers clearly for what kernel version your answer is valid. – lesmana – 2014-09-13T09:53:07.830
I am running with swap disabled on my home PC, never had an issue. 16GB of RAM. This can accommodate host + VMWare guest running development environment (VS2010 + SQL server 2014). OS is Windows 7. – Neolisk – 2014-09-14T11:34:06.127
1Why aren't you installing the game on the ramdrive and running it from there? – Sun – 2014-09-18T05:19:02.453
1
@usr: Whilst in theory you're correct, in practice, you're not taking into account design misjudgments from the Windows kernel programmers. See all the users who would beg to differ.
– Dan W – 2015-02-07T01:05:14.140@begtodiffer it is true that Windows misjudges paging decisions all the time. But with out page file at all, instead of one on a RAM disk, there is nothing to misjudge. – usr – 2015-02-07T09:02:19.037
1I guess it only takes to try it out to find out if it works for you or not. – user1306322 – 2015-02-07T09:08:15.510
1@usr: I was just responding to the point of "never accomplishes anything", as all those users experienced a performance increase when putting the pagefile into the Ramdisk. It shouldn't happen, but it does. – Dan W – 2015-02-07T15:20:11.197
@DanW those users should have disabled the file and would have gotten even better results. Putting the paging file on a RAM disk is always inferior to having no paging file at all. – usr – 2015-02-07T15:27:48.387
@usr: Again, whilst you're right in theory (and I agree with the spirit of that), there are a few reasons to not disable it completely. The most notable being that some applications (particularly older ones) require the pagefile to run. – Dan W – 2015-02-07T15:30:08.690
@DanW I have never heard about that. That would rquire the app to explicitly check whether the paging file is on and stop working if it is not. Few reasons an app would care about the paging file. Assuming, though, that such apps exist: set the file size to 1MB. – usr – 2015-02-07T15:33:21.100
IDK, but virtual memory / swapping / delayed loading certainly massively decreases responsiveness compared to older systems (such as Acorn Archimedes, or even old 8-bit Micros) which did not do this. It's a sorry state of affairs when a modern wordprocessor is less responsive for many operations (when first loading, or swapped out) than an 8-bit 2Mhz machine. Personally I would rather have "out of memory" error any day of the week than swapping to disk and the resultant massively degraded performance. This would encourage programmers not to waste RAM. – Sam Watkins – 2015-11-30T00:00:27.953
Paging virtual memory is like overconfidence, "Yeah, I can handle this job by myself, no worries!" whereas in fact the computer would take a month of swapping to finish the job and doesn't even know it. If a job works well with serial access it should be using files in the first place. If a job requires rapid random access on a large chunk of RAM (e.g. for an in-memory hash, or for executable code), in no way is it acceptable to be swapping that RAM in and out from disk during the operation. The computer pretends it has infinite RAM, but this is a lie and not a helpful one. – Sam Watkins – 2015-11-30T00:01:33.330
Even for jobs that seem to require more memory than is available, swapping whole pages in and out is rarely the most efficient way to utilize the memory. Better if the programmer designs the job to use RAM and files efficiently as needed in the first place. – Sam Watkins – 2015-11-30T00:08:04.793
possible duplicate: Windows Swap (Page File): Enable or Disable?
– Ƭᴇcʜιᴇ007 – 2016-05-04T16:14:47.783