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."
OMG, you mean you didn't read the article and possibly learn something?
/. world.
Honestly, I wonder why people take the high and mighty road. The number one problem with computers is people simply don't understand them. The number one way to solve this problem is to educate the user about these little facets of the OS.
The article covers some very basic differences in plain english, and unlike the 'just to do this and leave me alone' attitude, puts the user one step closer to a positive computer experience... a tough thing in today's virus/trojan/adware
"The more pity, that fools may not speak wisely what wise men do foolishly" - Touchstone,Shakespeare's "As You Like It"
How could he? 15 posts and the server is toast.
Religion is a gateway psychosis. -- Dave Foley
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.
I'm not sure if Linux has a paging file, but I fail to see why the linux swapping can't be done preemptively as well. If a program loses focus, swap the memory used by it, but retain the active copy in RAM. If another program needs the RAM, release it. If the program comes back into focus, clear the swap copy. Seems like it would give the best of both worlds.
Article Text:
We have all been using the terms swapfile and paging file interchangeably. Even Microsoft invariably refers to the paging file as the swapfile and vice versa. However, the swapfile and paging file are two different entities. Although both are used to create virtual memory, there are subtle differences between the two.
The main difference lies in their names. Swapfiles operate by swapping entire processes from system memory into the swapfile. This immediately frees up memory for other applications to use.
In contrast, paging files function by moving "pages" of a program from system memory into the paging file. These pages are 4KB in size. The entire program does not get swapped wholesale into the paging file.
While swapping occurs when there is heavy demand on the system memory, paging can occur preemptively. This means that the operating system can page out parts of a program when it is minimized or left idle for some time. The memory used by the paged-out portions are not immediately released for use by other applications. Instead, they are kept on standby.
If the paged-out application is reactivated, it can instantly access the paged-out parts (which are still stored in system memory). But if another application requests for the memory space, then the system memory held by the paged-out data is released for its use. As you can see, this is really quite different from the way a swapfile works.
You have enemies? Good. That means you've stood up for something, sometime in your life. --Winston Churchill
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
Not really true. On application servers, it's best to set a static pagefile. Heck on SQL boxes its sometimes best to not even have a pagefile... Letting Windows manage your pagefile decreases performance, as it leaves something else for the CPU to do and something else for the disks to do. Put a page file on another disk (or other partition if you don't have another disk). Make the pagefile 1.5x the amount of RAM you have (up to 4 GB anyways). I've found this works well and gives the best performance for most systems (with the exception of SQL and ORacle servers)
I didn't marry her for her looks, she didn't marry me for mine. She is a damn good wife and mother, has a good sense of humor, and a good work ethic. She isn't a full-blood geek like I am, but she is close.
I don't now if the OP was joking or not, but thanks, I am glad to see more than one person who sees women as more than just T&A. Come on, how many women let their men spend hours writing code and only bug them with "need another soda?"
I'm not sure if Linux has a paging file, but I fail to see why the linux swapping can't be done preemptively as well. If a program loses focus, swap the memory used by it, but retain the active copy in RAM. If another program needs the RAM, release it. If the program comes back into focus, clear the swap copy. Seems like it would give the best of both worlds.
If you're talking about losing focus in the window manager sense, it's not possible under linux without some very specific hacks:
If the window manager ran in kernel space, then it would be possible. Running a window manager in kernel space also would provide a very handy way to bork your whole system with a poorly written gtk app. It would also break the security model of linux.
Now, maybe if kernel hooks were added in so that parent processes could tag their children for paging, that might go somewhere. I don't know all that much about kernel internals yet, though.
If you're talking about losing focus in the sense of going to sleep, there's no reason why it can' happen because init handles all that anyway.
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
use linux, you muppets.
.........
Dude, ever heard of VM/370
or maybe Multics
or, more obscure but even earlier Atlas
I have gone back and forth between admin and non-admin a few times, more time without admin rights. Some programs have a tough time running, mainly because they want to access stuff they really shouldn't.
I think the problem is the developer culture that built up around Windows, coupled with its changing ideas of how to separate code and data. With Windows XP we essentially have the core idea behind Unix: a /usr and /usr/local directory (Program Files), and a /home directory (Documents and Settings). However, I have several programs that insist on saving data in Program Files instead of my home directory. This could be as simple as using the %HOMEPATH% environment variable, or using one of several Win32 API calls that do the same thing. Unfortunately, developers get lazy, use Program Files, C:\, Windows, etc. to store data. The only exception should be daemons such as Apache and MySQL that do not "belong" to a user, sort of like "nobody" in Unix. And there you have /etc, instead of dot files in /home. Sigh. The way things are, and they way they should be...
Anyway, the point is that this can make it very difficult to run certain programs without elevated permissions when you lock down the Program Files and Windows directories.
24 beers in a case, 24 hours in a day. Coincidence? I think not!
This must be the linux developer attitude:
The number one problem with computers is people simply don't understand them. The number one way to solve this problem is to educate the user about these little facets of the OS.
You could also say:
The number one problem with microwave ovens is grandma simply does not understand them. The number one way to solve this problem is to educate gandma about these little facets of the Maxwell's Equations.
or:
The number one problem with cars is drivers simply don't understand them. The number one way to solve this problem is to educate the driver about these little facets of the thermal cycle of the gasoline engine.
or:
The number one problem with televisions is people simply don't understand them. The number one way to solve this problem is to educate the people about these little facets of analog circuitry.
No, computers, like cars, microwave ovens, telephones, must just work, expecting the user to know how they work is absurd.
Yes, it can be a lot of work running as non-admin. But there's a certainly feeling of secureness knowing that half the worms and trojans out there can't get very far without admin rights too.
I just want to know how a Windows swapfile vs linux swap partition bashing thread turned into abortion rights!
-nB
whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
Umm, the file is called /proc/sys/vm/swappiness; I didn't make it up.
Oolite: Elite-like game. For Mac, Linux and Windows
Microwaves do one thing: heat whatever's placed inside them (assuming it contains water). Cars do one thing: take you from A to B. TVs do one thing: Display an image from an input signal.
Computers are general purpose devices. They can do many things. With flexibility comes complexity, there's only so much you can do to avoid that.
Even the fastest hard disk is currently over 70X slower than the dual-channel PC2700 DDR memory common in many computers. Let's not even start comparing the hard disk with faster RAM solutions like PC3200 DDR memory or...
riiight. excuse me while i laugh and read something else.
This is my Sig, this is my Gun. One is for Slashdot and one is for Fun.