Comprehensive Guide to the Windows Paging File
busfahrer writes "Adrian's Rojak Pot has a nice article about the internals of the Windows paging file. It explains what a paging file is and lists the differences between a swapfile and a paging file. But first and foremost, a large part of the article deals with the various methods of optimizing the Windows paging file, thus yielding a notable performance gain for people who are not overly blessed with RAM."
One of the biggest performance helps is to keep the paging file from being fragmented, and I'm not talking about three or four fragments.
I've come across workstations where the paging file is in thousands of fragments. This happens when someone messes with the settings. For instance, they might increase the size of the paging file thinking it'll help to have more. Normally, it's not a bad idea to increase it but if the drive is heavily fragmented, Windows dutifully uses the fragments for the new space.
The only way to fix it is to completely delete (deactivate) the page file, then do a defrag, then re-create the page file (several reboots involved).
That's probably the best way to tune the page file. There, I saved you from having to take the time to read the article.
A programmer is a machine for converting coffee into code.
Would Mr. File please pick up one of the white courtesy phones? Your OS needs to talk to you.
A forensically useful article!
The only PT Boat Journal on the web: http://www.PT171.org
I can't read the article now because it's slashdotted, but is there a difference between the swap file and the paging file in Linux? Does Linux even have a paging file?
And the men who hold high places must be the ones who start
To mold a new reality... closer to the heart
They might want to adjust the paging file on their web server a bit...
Given the speed of the slashdotting, I'd say he needs to add more ram to his box, and stop relying on the paging file for speed...
Online Starcraft RPG? At
Dietary fiber is like asynchronous IO-- Non-blocking!
I don't know, but I think we're all smoking it now.
People are going to argue this a lot, because geeks like to fiddle with things. Clearly, the thing isn't optimized until I have changed the settings !!oneoneone!!!
But the best way to optimize the paging file in Win2000 (and later) is to leave it alone. Windows will manage the paging system just fine on its own.
http://www.bysoft.com/freeram.asp
A free application that you can use to 'pre-page' out pages right before loading up your application. What it does is hog as much RAM as much as it can, forcing the OS to page out any unnessecary applications.
I've seen the standard Explorer + lsass + cwrss + all the svchosts memory footprint go from 80-ish megs to 20. Running this before your game will allow quick load-times and quicker performance.
Doesn't work.
... for people who are not overly blessed with RAM.
You mean those who's PHBs said the "minimum" requirements were good enough.
-- If god wanted me to have a sig, he'd have given me a sense of humor.
Did Slashdot really post a story on the Windows paging file during the site's busiest time period? I guess we should be thankful Zonk didn't post another dupe.
I dunno about Bill, but that tiny "Micro$oft" quip sure pisses off lots of MicroSlaves.
--
make install -not war
and It's called a paging file, because if they call it swap they couldn't get the patent!
Or maybe the will be figthing trying to convince the world that they came up with the idea of a swap space!
Rojak Pot? is I believe what Scooby Doo said when he Found Kojak's stash. And he would have gotten away with it too if it' weren't for those damn kids.
Unfortunately, it looks like Mirrordot completely cannot handle frames.
Firefox shows no content (presumably because it displays Mirrordot's banner, and thinks that framesets are invalid in that context).
Even if it did work, I doubt mirrordot would be mirroring the contents of the framesets - so it wouldn't actually help.
A brief tests shows that CORAL has better luck.
See Subject - there's no content on the MirrorDot page.
Wow. Three comments into it, and you're already playing the "Microsoft Sucks - Linux Rules" card.
Must be annoying for you Micro$oft fanboys when people keep bring that up.
It seems like Windows' treatment of virtual memory is inefficient. Why use a file for swap -- incurring ntfs overhead and fragmentation -- when you could use a swap partition (like Linux) without exposing the user to any additional complexity (which is the usual tradeoff for efficiency gains).
I had to upgrade my laptop from the stock 512 to 1.25GB just because WinXP thrashed the paging file so much. Granted, I multitask like a demon, but it shouldn't take 30 seconds to swap Firefox back in.
thus yielding a notable performance gain for people who are not overly blessed with RAM.
She has money, she has a title, she has huge... tracts of RAM!
#include <signature.h>
It doesn't piss us off nearly as much as Linux fans get when I say "LINE-icks".
I am very small, utmostly microscopic.
It's 44 Pages!! I mean heck, the average /. doesn't read one page news stories, but a 44 Page Article!? Not in this lifetime.
Your hair look like poop, Bob! - Wanker.
c'mon, who gives a fsck?
Liberal (adj.): Free from bigotry; open to progress; tolerant of others.
why RTFA I have 1 GB RAM
At 1gb of RAM, I've been able to completely disable the swap file, and run a player server UT2004 game on my machine. At this point, the only thing that killed it from excessive RAM usage was a very large assult map and about 12-16 players in the game. Completely disabling the swap file (IF YOU HAVE THE RAM TO DO SO) is a great performance boost to the computer over-all, as it requires much less disc access.
Make sure it's a fixed-size page file, not system-managed.
By using 'Diskeeper,' you can also do some additional optimizations besides just defragging it; it's a nice app, though its warnings are overly-dire, and it insists of having something staying in memory all the time, which is irritating.
For God's sake, put a Printer Friendly link on your site so I can print the whole article. Having to read lots of text on my 14" EGA monitor makes my head asplode!
The site is so slashdotted that it took forever to load the first page which basically has nothing but useless history of swap files on it. Even the mirrordot doesn't appear to be working. Anyway, one sentence on that first page made me no longer interested in reading the article:
Whenever the operating system has enough memory, it doesn't usually use virtual memory.
This flies in the face of real world experience. You can have 4 gigs of RAM and nothing but Windows 2000 running and your OS will still use the swap file frequently. Don't believe me? Run Performance Monitor and monitor Memory, Pages/Sec and just click on a few things and you'll see that I'm correct.
I'm a big tall mofo.
Or use any of the various disk defragmenters out there that support defragmentation of system files like the page file, such as Diskeeper.
Kicks the crap out of Windows' built-in defragger, and is much faster too.
IIRC the use of the term "Swap" is incorrect in the Linux world too. Linux sends pages to virtual memory, not swapping out whole apps.
In fact, is there any major OS that still swaps?
Adrian's Rojak Guide on how not be slashdotted.
http://www.michel.eti.br
I agree with you. Sorry for the moderation points though.
The solution they came up with was to use some space on the hard disk as extra RAM. Although the hard disk is much slower than RAM, it is also much cheaper and users always have a lot more hard disk space than RAM. So, Windows was designed to create this pseudo-RAM or in Microsoft's terms - Virtual Memory, to make up for the shortfall in RAM when running memory-intensive programs.
Amazing how they manage to turn everything around as though Microsoft invented the world of computing...
Virtual memory, the term and the implementation have been around long before Microsoft came into existence.
To read the start of the article, you'd think there were no non Microsoft operating systems when DOS came out and that Microsoft invented the concept of Virtual Memory.
I couldn't read any more after that.
-Disgusted AC in PA
Cant get to the listed site since its totally /.ed but another interesting one re: XP, 98, me and page files
Virtual Memory in Windows XP http://aumha.org/win5/a/xpvm.htm
Windows 98 & WinME Memory Management http://aumha.org/win4/a/memmgmt.htm
and there is
How can I optimize the Windows 2000/XP/2003 virtual memory (Pagefile)? http://www.petri.co.il/pagefile_optimization.htm
--
Time is on my side
What is the reason for this architecture?
There's a good reason why people don't write about VM systems often; the combination of writing skill and the ability to understand modern VM is extremely rare.
Take most, if not all, of what the article discusses with a large grain of salt. Everything, from his history (did Microsoft invent demand paging? Hardly) to his terminology is flawed.
Just reading the first 40 comments or so here reveals that VM remains one of those "black magic" areas, where reason is overcome by superstition and people will assert the most ridiculous, irrational and unsupportable things. Regrettably, the contents of this article do nothing to improve the situation.
= Mike
Linux will page and swap to swap files. Usually people use a partition for swap, but occasionally it is useful to add swap space via a file - such as when one is running low on swap.
Linux allows multiple swap files.
In the old days on Unix-like systems, it was necessary to have more swap than RAM - as each allocated page of RAM was also allocated a page of swap. That is on longer the case.
At my current job, on lab machines I usually have more RAM than disk space. If I alocate any swap space, I will allocate just 200-500MB. Many of the machines have 6GB RAM. I need to work to get those machines to swap.
Where law ends, tyranny begins -- William Pitt
I have over a gig of RAM but my laptop's HD is rather slow. How do I make it so that my computer will not use one of these files? I doubt there are many times when I am using all of my RAM, so I'd want to keep the HD use as little as possible.
That only works on *nix. How can it optimize windows?
The article is a little misleading. Virtual memory is not just space on a hard disk that you use when you run out of physical memory. Virtual memory is the practice of giving each process its own virtual address space that is independant of the physical address space. Doing this allows the OS to send some pages of memory to disk if it needs to, but the OS is still using the mechanism of virtual memory even if there is no hard drive at all. Each process's memory space is independant of the others'.
Saying that it is a comment on Kolchak's pot would have been even better.
Virtual Memory is not the same thing as Page File.. Most things on a Windows box will be loaded into "Virtual Memory". This merely means it is using Virtual Memory Addressing provided by the onboard Memory Controller. This allows for such great things like multiple instances of a single application, nad not having to worry about applications over-writing each others RAM. Virtual Memory addressing is also great for things such as DirectX. Using this, you can setup a virtual memory address that addresses Video RAM instead of System RAM, and can be accessed as a normal pointer in C/C++/ASM/etc.
If you have 512 MB ram, how large is the swap partition supposed to be set? I always read that it shouldn't be larger than 128 MB. That was the advice given when most systems had 64-128 MB of ram installed. Does this rule still apply today?
Turn off virtual memory and see how many MS apps suddenly stop working at all. And we're not talking memory pigs, either. Some screen savers don't run without virtual memory running, no matter how much RAM you have. It's really stupid.
Boobies never hurt anyone. - Sherry Glaser.
I've run into similar problems. I have 1 gig of ram on my machine, if I have my java ide loaded up, and run a game or something like UT2k4, and play for a bit, when I exit out, my machine will thrash like made. But then I tried just disabling the page file altogether because of someone's suggestion, and ya know what? Everything works fine, no memory problems, no thrashing.
Actually RD is another command for RMDIR
n /w indows/xp/all/proddocs/en-us/rmdir.mspx
See Microsoft's website for details:
http://www.microsoft.com/resources/documentatio
Use the free PageDefrag utility from http://sysinternals.com.
This guy makes it sound like Microsoft invented the concept of virtual memory. Uh, dude, ever heard of Unix?
It's an article about paging files - of course there's going to be a lot of pages in it.
Bears don't normally eat things that talk and move backwards.
It explains what a paging file is and lists the differences between a swapfile and a paging file.
There is no difference.. He says that swapfiles would swap whole processes. I beg you pardon? Working on whole processes hasn't been the case since 'multiprogramming' on third generation computers (around 1965-1980).
btw, a good program to defrag your Windows page file is PageDefrag
Together with Dirms & Buzzsaw, you can keep your disk defragmented for free. Especially Buzzsaw is nice since it will defragment recently accessed files in the background.
Asplode? Isn't that what happens after you've eaten something suspicious from that greasy spoon down in the shady part of town?
use linux, you muppets.
.....
Well, they tried, but I think they really missed some very commonly-held misconceptions.
I've just finished a project involving reconstructing process images from physical memory, including pages from swap, if available, so I've got a pretty good understanding of this stuff at a very low level.
Misconception 1: Swap-file usage = performance degradation
Yes, it is slower (usually by 3 orders of magnitude, not 1) to access a page (frequently 4K) from disk instead of memory. HOWEVER, effiency dictates that all available RAM be utilized as soon as possible.
For example, in addition to running processes, we also use volatile memory storage to cache file data. Clearly, we want to cache as much as possible. Page replacement policies then become important to determine how much swap space to use. But usually it is much greater than 0, because we've got process image pages that are less frequently used than a lot of file cache pages. So we've gotta remember that data, but we don't wanna waste fast RAM on it.
In other words, isn't it great that we can swap out pages from an unused process to make room for frequently accessed file data? Regardless of how much memory we have, that's a Good Thing.
Misconception 2: Virtual memory = disk space
Virtual memory is a mechanism for translating program-visible addresses to arbitrary storage locations transparently. This doesn't necessarily mean that disk space is used for swapping memory, it means, for example, that 5 processes can simultaneously be accessing address 0x5000, but the actual storage location is different for each. If the system (usually the page address translation facility on the CPU) determines that this address isn't at some location in volatile storage, it will bring in that memory from swap space and possible page out some other data. This is what the article is generally talking about.
I've seen some other questions about pages. There are a couple reasons for treating memory in page-size chunks, where a page is usually in the 1-8k range (4k for x86). First, the page address translation stuff needs to keep data on translations. It must do this in > 1 byte chunks, since keeping translation data on every byte would require way too much storage. Disk I/O and other I/O is frequently done on page-by-page basis for that reason as well as for the sake of performance.
Well, I rambled enough. Just wanted to clear a couple things up.
I found this link to the article: Swapfile_Optimization
Suncoast Linux - Sarasota, FL
The /s option means delete recursively and /q means don't ask for confirmation so this command will delete all files on your current drive. A somewhat crafty (but evil) post.
Rojak is a type of salad eaten in Malaysia and Singapore. The term "rojak" is also casually used in those countries to mean "a mixture of everything."
The term Rojak Pot, I assume, is meant to portray that this website talks about a wide range of topics.
oh, so now bad puns are Trolls?
It spends a lot of time discussing what really happens in various situations and asserting that some theories that have been promoted are maybe incorrect, but does no investigative research.
Moreover, all these performance claims are bandied about, and yet I see no benchmarking.
Try harder, windows folks.
-josh
I've always gone on the idea that if you are useing more than 128M of swap space than buy more ram. You're beating your hard drive to death. I've sense uped that to about 512Ms though because to many people would argue with me about having a swap file that's twice the amount of RAM on the box. well we have a box with 16G of ram you want a 32G swap file????????? If you were working on 32G of data in and out of swap you'd be hateing life, even on a fast scsi raid.
Paying taxes to buy civilization is like paying a hooker to buy love.
I don't usually set out to bash windows, but the windows virtual memory subsystem is as dumb as a brick.
At work I am blessed to have 1GB of ram, so I don't ever need to use any virtual memory. What I find really interesting is that windows is noticably more responsive when I turn off virtual memory entirely. Even though I'm never running out of memory, windows was always swapping things out that I needed soon when I had virtual memory enabled. And I'm talking about when I had 2/3 of my memory unused still (at least by applications, the disk cache could have potentially been using the rest). Just turning off virtual memory altogether made things much much more responsive/faster for me.
Any suggestions? I seem have stumbled on this Windows site by mistake. For years it seems this was a Linux site, but I must be mistaken. (It must have been datslosh.org, or something. Old age takes its toll on the memory, and causes the mind to play tricks on you. Strange that should happen though, since I've read this site nearly every day since it came online.) Mind you, now I realize that there are too many Linux sites on the web already, and some of them should probably switch to reporting on Windows just to balance things out. Maybe I should just switch to Windows and support this effort. Any comments? Suggestions? (BTW anyone know what Bill Gates had for breakfast?)
Putting http://text.burstnet.com/* into adblock makes for a slightly less annoying experience, but there's also the fact that it's 44 freaking pages long. Probably getting paid by the site hit or something.
Do yourself a favor, give this content-lite article a miss. Make a small partition with ntfsresize, put a fixed pagefile on that partition alone. Works on every single version of windows and it's zero maintenance. Tah-dah.
I am no longer wasting my time with slashdot
No sig for now.
Paging is what my office looks like, with parts of differnt projects hanging around.
Swaping is what my 'to read/reading' pile looks like, a book is in the pile or it isn't.
It is always amusing to me to read how M$ "invented" technologies that were in common use by other operating systems while Bill Gates was still wearing diapers. Both paging and swapping were used on IBM mainframes dating back to the mid 1960's. What windoze (and linux for that matter) could REALLY use is the ability to deterministically dedicate portions of system resources to particular processes.
Back when a 1 MIP, 1MB machine cost $1M, operators became highly skilled at managing workloads. Today everyone just throws oodles of RAM and disk at servers and lets the chips fall where they may , so to speak. It wouldn't be a bad idea to actually put a little thought into matching workloads with machine resources, and pro-actively matching them up by deliberate choice(For example - our company is running a prime-time ad at 9pm that features our URL, maybe that's a good time to shut down the normal file backup that happens then). Chaos theory is not always a good load balancer. But what am I saying, that's as outrageous as asking kids to put their money in the bank instead of buying video games...
"Sic Semper Path of Least Resistance"
It said in section about optimizing: "Moving the paging file to a RAM drive" Isn't putting a page file on a ram drive kind of, well, counter-productive?
I realize that my posting could be construed that way, but what I'm really trying to drive at is that some people are stuck at stage 7 of the Evolution of a Linux User.
These people can be, by far, the most annoying.
Some people are just so blinded by their zealosness, that they end up annoying everyone that they meet with their "Bill Gates is the Anti-Christ" schlock. Regardless of the validity of the point, firing that off as a knee jerk reaction will quickly get you labeled as an ass hat in many people's books.
I noticed that my swap was getting full even though I had ram available under Ubuntu. I tested "swapoff -a" then "swapon -a" and my ram got used up while my swap was empty. Anyone know of a better way to ask the kernel to use the ram instead of the disk? Or am I dumb to even try this in the first place?
I love your sig man. That is one of the really memorable parts of the incredibles movie.
Now to stray back on-topic for a moment...I have observbed the same thing. Stupid windows apps not starting because there is no virtual memory even though you have copious amounts of actual memory. Argh!
Nice article except that virtual memory was around since the late 70's and was neither invented nor termed by Microsoft. So really, as usual, Microsoft did "come up with" anything.
This is the worst lengthy discussion of the topic I've seen yet. Who posted this thing, what is their cut?
Yes, but you see a slightly skeptical user would be alot harder to convince when you try to tell them that RMDIR stands for Reseat Memory/Directory with the /s = sequencially and the /q being quitely so that they are not bothered with silly questions every time the program runs into a file that it isn't sure of what to do with.
Now RD is a much easier placy it obvously stands for Reorganize Disk, with the sequencially and quietly options set.
This artical is way too damn big for something like this.
Here is mine;
Step 1. Put pagefile on differant drive than your OS drive
Step 2. Do stuff.
The end.
Notice how this website with an article on the Windows paging file did not get Slashdotted. I wonder why...
Depends on your application, I guess. If you have large files that you're accessing more frequently than some large program's memory, it seems the ram would be better spent caching pages of those large files. To quote you, if you were working on 32G of data-from-fiels in adn out of the filesystem you'd be hating life.
Note that on the basis of this article, someone has told me that linux only swaps so it's crap. Now, he was obviously wrong, because linux "swap" is a paging system, not swapping, it's just named swap.
But now we can expect countless jerks to jump to the same conclusion. Oops. Time to s/swap/page/g ?
For example, even under Windows 3.1, the swap file only swapped in chunks of 4/8k. It's just that, on machines that were memory-poor (like we all were way back when), most users had their boxes configured with a 3/1 ratio of swap to real ram, and most of their free real ram then ended up being used to manage the swap file. 2/1 was the sweet spot.
The DOS Shell program, on the other hand, worked by swapping out whole processes, allowing DOS 5.0 and up to appear to multitask.
Pick up a copy of any decent assembler manual for the 2/386 from the early '90s, look for the instructions for swapping pages into ram. It's a hardware function. On a page fault, the cpu then goes through a look-aside buffer (8k worth of pointers each, IIRC, local and global), and then you can map pages of ram in/out as required. Just don't triple-fault, as the cpu would then go out of "enhanced" mode and/or reboot.
Must be a REALLY SLOW day for this to be "news".
How does the ordinary load time compare to the load of this tool + the faster load time of the game?
emt 377 emt 4
To my taste Windows XP already prepages to much. It's not fun when your browser needs to swap back in when there is still 600MB RAM left of the 1 GB you have.. :-/
The Thing King!
Maybe it does, but the parent poster has a point in that the MS-Linux card is played by the third post and that it just gets plain boring to see after the thousandth time. There isn't one subject on Slashdot that can manage to avoid it either apparently.
~S
Who needs a page file when you have a 10.00 GHz AMD Athlon, a 2000 MB DIMM, and a 30000 GB IDE Hard Disk http://www.amazon.com/exec/obidos/tg/detail/-/B000 22ACYK
I quote from a review:
"I was a little skeptical at first on how this thing would perform. However, when I installed and run the Seti@home program it started instantly finding alien signals, which where corrected, cleaned up and translated.
I am now listening and talking to the supreme galactic defense minister about Earths surrender. Apparently this computer is not only tapping into the sun for power but also into the mysterious dark energy and tearing the universe apart. Just comes to show how bugs always show up in technology when you least expect it."
Either way, buy more ram.
Paying taxes to buy civilization is like paying a hooker to buy love.
I don't know why screen savers would stop working, but I bet the developers never planned for the creation of shared memory failing.
What do you actually do? I also have an office PC with 1GB of RAM and, right after booting up, the OS requests the creation of a pagefile.
My gut feeling is that 1GB is plenty of memory for what I typically use this system for, yet I can't get past the Windows' whims.
Thank you for any hints you may provide.
Serban
Based on the comments here, it sounded awfully stupid. When I went to RTFA, the site was too slow to load the entire page. But luckily, the answer to the immortal question "what kind of pot is that guy smoking?" was right at the top of the page.
Sweet!
Now before I get modded down, I be to remind whoever might read this that what I am saying is FACT. - bogaboga
This is exactly right. Right after I read the first page I was thinking, "No Microsoft did not invent Virtual Memory and you're not clear on what Virtual Memory is in the first place."
If the rest of the article is as inaccurate then we ain't missing much from the Slashdotting.
Happy people make bad consumers.
I have been toying with the idea of putting the page file on a partition of its own. Anyone think this is a good idea?
Calling atheism and agnosticism a religion is like calling bald a hair color.
That one byte that isn't used for Microsoft apps will be used to run all other applications. Those programs will continue to be written as if they have normal access to RAM, but Windows will operate them in the following manner: All of the memory of those applications will be stored on the hard drive in a format that is very slow to read and write. Each byte will be converted into a string, so a 127, for example, will turn into the string, "One hundred and twenty-seven." These will be stored with one string on a line. As the program executes, each individual byte of it will be swapped in from the disk, being interpreted from a string into a byte, to that one byte in memory, and then swapped back to the disk to make room for the next byte. Not only will each individual memory access become incredibly slow (hundreds of thousands of times slower than under normal execution), but it will also promise that the processor will waste nearly all of its time managing this mess:
Time will be wasted converting bytes to and from strings.
Each time the processor needs to access any byte of program code or data, it will trigger a page fault, which will have to be handled by Windows.
32-bit data formats, such as integers, will have to be processed byte-by-byte.
In fact, it would actually be too difficult to let the real processor in the machine handle all of this crap. For that, Microsoft will integrate Bochs into its code, and use Bochs to execute all non-Microsoft programs. Bochs will be reverse-optimized, of course, by inserting deliberate delays in various strategic places, making inner loops process too much junk unnecessarily, and, finally, by running Bochs itself in an interpreted environment, with the interpreter being written in Visual Basic 6, which Microsoft no longer supports. To make graphics work really, really, really slowly, all operations will be converted into a string of GetPixel, PutPixel calls to draw individual pixels.
Microsoft will explain that all of this benefits the consumer and corporate customer because: By leveraging innovative technologies, content providers streamline compelling enterprise solutions. In the meantime, only programs made by Microsoft will execute quickly. Microsoft will advertise that all other software companies make slow software, and therefore that you should ONLY buy Microsoft software. And they'll tell you that Linux has a higher TCO, lower ROI, and you'll get sued for using it. Stupid PHBs will believe them, and it will come to pass.
So it shall be written. So it shall be done.
I first deleted all paging files and rebooted. This allowed me to start fresh. I followed these steps to setup my new paging file:
I followed the instructions in the XP Tweaking Companion guide. It's a nice all-around guide for optimizing XP.
...or at least, it does not exist in linux 2.6 today, so it may be the same in windows
Yes, you read well. "swap files" are as fast as "swap partitions" under 2.6, altough not many people seems to have realized. I've not the link at the lkml messages from Andrew Morton explaining why at hand, but the "post halloween" 2.6 doc says it too. As I understand it, its "simple": Swap files bypass completely the filesystem layer in linux 2.6 so there is basically zero advantage in using partitions instead of files. Windows probably does the same, I guess, since it was designed from the start to have "swap files".
You still face the defragmentation problem, but that's a minor issue - it's not impossible to create a contiguous file, in fact when you install a system most of the filesytem will be almost void and the swap file probably will be contiguous. I doubt you could measure any performance improvement in using swap partitions vs swap files these days.
In short, unless you've very good reasons to use a partition, you probably should use files. Partitioning is usually the hardest problem for newbies when trying linux, and not having to use a partition for the swap can help.
Program Intellivision!
From the article:
"...to create this pseudo-RAM or in Microsoft's terms - Virtual Memory"
Didn't this term exist already? I think MacOS used it before Microsoft. Anybody know?
At least none on this machine, running 1.0 GB of RAM and no pagefile. 'course, this machine is about as far from a typical windows machine as one can get while still having windows installed, but still.
--- Ãther SPOON!
Larry Osterman writes in his blog that the author fundamentally doesn't understand what he's writing about. Mr. Osterman has worked at Microsoft for 20 years. How old is the author of the article?
Read Epic the first RPG novel.
"At work I am blessed to have 1GB of ram, so I don't ever need to use any virtual memory."
That's not true. Paging is a *good idea*, even when you have enough RAM.
Now, if Windows is paging out things that you were using, it's a different situation. But this hasn't been my experience. I've found that Windows only pages much when I run memory-hungry games.
Umm, the file is called /proc/sys/vm/swappiness; I didn't make it up.
Oh well, in that case I take it all back. You aren't cool.
HA! I just wasted some of your bandwidth with a frivolous sig!
I posted something similar when a discussion of the linux VM came up. Now days you don't really need twice as much swap as RAM unless you are very dificent in RAM. I mean in theory swap is supposed to offset a deficency in RAM so making a bigger swap for more RAM is sort of counter intuitive. About the only reason to make the swap that big is for a memory dump in the event of a system crash (or so I read once). I think most installers just default to 2x RAM because it's an easy calculation. For most systems I doubt you'd need more than 1-2Gb.
Then you can put your windows pagefile into linux swap partitions. :-)
It's
I used to run Windows 2000. Athlon XP/1700+, 512MB RAM, 7200 RPM/8MB cache hard disks. Been using Firefox since 0.6. I'm almost convinced that Windows is programmed to swap it out ASAP and to take ALAP to swap it back in. I could minimize Firefox, restore Thunderbird, check a few RSS feeds or e-mails, then try to restore Firefox, and wait a long time, indeed sometimes 30 seconds, for it to be completely restored so that I could actually use it again.
No, I had no spyware or viruses; I had Norton AntiVirus 2004 with Auto-Protect on, ran Ad-Aware and Spybot Search & Destroy regularly with updated definitions, and used IE never. I've been using Windows since 3.11, so I know my way around; it was a clean installation with no extra junk running in the background. The paging file was a fixed 1024 MB file on its own partition. The registry was defragged and compacted with RegClean and NTREGOPT. Yet even with 100 MB of free physical memory, Firefox would get swapped out and take a LONG TIME to swap back in. FOR NO REASON. While, on the same installation of Windows, IE would not get swapped out like that.
Solution: a different OS. I'm now running Debian with 2.6.10 on the same hardware, using Firefox and Thunderbird as before, and things are 200% better.
Windows: Just Say No.
"Those who consume the bulk of goods are those who make them. We must never forget this secret of our prosperity."
System V UNIX had no virtual memory until the late 1980s. Sure, there were specialized versions, such as BSD with VM added on, but it wasn't in stock UNIX. It was around though, and was in IBM 360 and Multics (1960s).
Dude, your question alone is MUCH MORE on-topic than the article itself! Furthermore, it SHOULD BE submitted ("ask slashdot". Between the readers here i'm sure we could gather 10 times more information than what the article did using 10 times more words than necessary.
I was reading til page 8 when i BEGAN to get to the interesting stuff. It just wasn't worth it.
If you do have the memory, disabling the page file is the best thing you can do performance wise. In theory this is a bad idea, in practice it works very well.
I have 1GB of memory. This is more than adequate for browsing, games, development, photoshop etc. So, two years ago I disabled the page file after discovering that with 300MB in use, windows was still swapping like crazy (and yes I had all the popular registry hacks applied which should prevent that). So eventually I disabled the page file. The immediate result of doing this is that applications become much more responsive. Suddenly multitasking becomes easy and fast.
Normally when you work with an application for a while, all other applications get swapped to disk. It doesn't matter that you have 700MB of unused, readily available ram. So when you try to alt tab to them, windows spends a couple of seconds moving stuff back into memory. This is very annoying and totally unnecessary. The problem only becomes worse if you start to run some memory intensive programs because windows will swap aggressively then.
Disabling the page file fixes this problem. The only disadvantage of doing this is that when you need more than 1GB it isn't there. This is typically the point where things would get very slow anyway due to swapping. In any case, this doesn't happen very often and is easily resolved by closing some applications. All games are optimized to run well with 256-512 MB. Most games don't use more than that, even if it is available. Office applications and other desktop software rarely use more than 100MB. Photoshop can push the limits but unless you are doing some extreme high resolution photography stuff with it, you will not run into any problems with 1GB. It's actually quite hard to run out of memory. Most things that are infamous for memory usage like ms flight simulator, doom 3, photoshop, vmware, etc all run without problems and without swapping.
If you think about it, swapping is a really lousy solution unless you expect to run out of memory. Disk is many times slower than ram. The reason that you open programs is that you want them ready for action. Swapping them to disk is therefore undesirable. The only reason it would be desirable is if the total amount of memory used by all of your running programs is larger than the amount of memory you have. So if you have 256 MB, swap files are a nice poormans solution to the problem that you don't have enough memory. If you have 1GB you shouldn't have that problem (and if you do, buy another GB).
Jilles
I agree with you, I can't see how anyone would claim that forcing the page swapper to pass through the filesystem layer, rather than writing the pages directly at the device level, is somehow better.
The Windows method of going through the filesystem is going to be pretty inefficient, especially given that we're talking about NTFS here.
At least at some time in w2k direct sound also stopped working if you disabled virtual memory. Not sure if this is still the case with WXP / W2K+SP4
Define 'unborn child.' Most Republicans use this term to refer even to fetuses of any stage.
"Your not a human until your in my phonebook"
Shouldn't one always read EVERYTHING that the writer has to say before giving out comments?
Plus, at least he tried and write the article. Not accurate? SO what, help the author correct it to be so and help save the world for further condemnation with wrong information!
I just keep seeing bashing saying I'm right and you're wrong but no further actions to help right the wrong.... is that smart? I think not.
This article was first written in 1999.
I tried this on a machine with no hard drive, and I still got 40m swapped. Bug?
Agreed.
All my machines have 3 partitions.
C: SYSTEM - NTFS 30G - Programs and Windows
D: SWAP - FAT32 2.5xRAM - Swap File partition.
E: STORAGE - NTFS Rest of drive - Data and stuff
This way NTFS doesn't break up the swapfile by putting MFTs every so often, and the access times between data and programs is kept low by being inbetween the two file partitions.
Easy enough that even new plebs can see how it averages out the distance needed to seek between the two locations of file.
"We know what happens to people who stay in the middle of the road. They get run over." - Aneurin Bevan
I agree
Exactly because of the reason mentioned by the parent, I have doubt whether defragging the pagefile really has such a large performance gain. Anyway, on linux the swapfile is not fragmented, but the drive still seeks like crazy during swapping. More explanation is invited.
But, on the other hand, if Microsoft hadn't spent two decades playing dirty tricks on their competition and screwing over their customers, people wouldn't feel such animosity towards them. It wasn't as if the majority of the computer-using world just woke up one day and said "you know, I don't really like Microsoft all that much". Microsoft made this happen. Now, they catch a lot of (undeserved) flack as people's irritation with other things they've done gets burned off on the wrong issues, but Microsoft is no innocent victim.
Does anyone know how to disable the page file in Win 2000? I know how to do it in XP, but it seams that 2k must run with a page file. Just wondering is anyone knew of a registy key or something that will let me turn it off.
hmm... for fun I enjoy launching DDoS attacks against 127.87.42.5
I truely hate these popup links in text, I move my pointer over the text to aid reading, and wham I can't read cos some stupid script has poped up a sponsored link.
Just voicing my objection to this all to common practice.
I went into the article looking for that kind of thing, and like you, I thought I had found it. But you'll note that, technically speaking, the author does not say that Microsoft invented paging -- just that Windows was designed to use it. Likewise, he says that Microsoft's term is "Virtual Memory". He doesn't say that is the originally correct term.
Whether that means the author knows what he is talking about, or if he was just lucky, I don't know.
dragonhawk@iname.microsoft.com
I do not like Microsoft. Remove them from my email address.
"Windows 3.0 had virtual memory support in 1990 ... so did every server OS at the time."
:)
NetWare didn't.
I know, nobody cares. But hey, it's Slashdot.
dragonhawk@iname.microsoft.com
I do not like Microsoft. Remove them from my email address.
My understanding:
Strictly speaking, "virtual memory" means the addresses seen by the running code are translated to physical addresses (by the MMU). Thus, the code sees virtual addresses.
"Memory protection" describes the feature where the running code is prevented from accessing certain parts of memory, for security/stability reasons. This is called "memory segmentation" on some architectures, which is where the Unix phrase "segmentation violation" (SIGSEGV, or "Segmentation fault) comes from.
I know there are systems which implemented protection without virtualization, and I suppose it's possible (if silly) for the reverse to be true, too. So, while the two are closely related, and both are implemented by the hardware MMU (Memory Management Unit), they are not the same.
Note that the above kind of "segment" has nothing to do with the 8086's 64 KB segments. The 8086 supported a 1 MB address space, but a 16-bit address word was used for most things. I assume that was due to price/performance limitations imposed by the technology of the day, but I don't know.
The 80286 did support memory protection, but not a flat memory model. You still had to worry about segments, although the segments could be larger. (I want to say 16 MB, but that might have been the total address space -- it's been awhile.) I don't remember if the 80286 supported virtualization.
"Swapping" means taking an entire process's memory space and writing it out to disk. This came first, because it can be implemented without an MMU.
"Paging" means taking chunks of memory not recently used and writing them to disk. So-called because virtual memory manages memory in chunks called "pages". This needs an MMU, because the process keeps running even with big chunks missing. When a process tries to access a page that is out-of-core, it causes the MMU to issue a page fault, which the OS traps. The OS then brings the page in from disk and resumes the process.
dragonhawk@iname.microsoft.com
I do not like Microsoft. Remove them from my email address.