Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Windows Operating Systems Software IT

Comprehensive Guide to the Windows Paging File 495

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."
This discussion has been archived. No new comments can be posted.

Comprehensive Guide to the Windows Paging File

Comments Filter:
  • by UCFFool ( 832674 ) on Friday March 25, 2005 @04:29PM (#12048822)
    OMG, you mean you didn't read the article and possibly learn something?

    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 /. world.
  • by Monkelectric ( 546685 ) <{slashdot} {at} {monkelectric.com}> on Friday March 25, 2005 @04:33PM (#12048868)
    OMG, you mean you didn't read the article and possibly learn something?

    How could he? 15 posts and the server is toast.

  • by Entropius ( 188861 ) on Friday March 25, 2005 @04:36PM (#12048893)
    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.
  • by TheFlyingGoat ( 161967 ) on Friday March 25, 2005 @04:44PM (#12048972) Homepage Journal
    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.
  • by alta ( 1263 ) on Friday March 25, 2005 @04:44PM (#12048974) Homepage Journal
    I think this is a fine idea for a server with competent sysadmins, but not so good for an end user...

    Say, a rule of thumb is, your page file is 2x the size of your physical memory. My mom takes her computer to best buy, and she goes from 128MB of memory to 512MB... typical situation. Now, her windows pagefile will grow accordingly. Or if I manage it for her, I would manually change it. But what if I had to tell her, "well now we have to remove everything on your computer to resize your paritions"?
  • by Peaker ( 72084 ) <gnupeaker@nOSPAM.yahoo.com> on Friday March 25, 2005 @04:45PM (#12048988) Homepage
    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.
  • by Anonymous Coward on Friday March 25, 2005 @04:45PM (#12048989)
    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

  • by MSFanBoi ( 695480 ) on Friday March 25, 2005 @04:49PM (#12049014) Journal
    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)
  • by timster ( 32400 ) on Friday March 25, 2005 @05:02PM (#12049152)
    I don't understand why you would need to increase the size of the page file when you had just increased the RAM.

    The size of the page file needs to be the amount of virtual memory you need available minus the amount of physical RAM. So when you increase the RAM, it's appropriate to decrease the size of the page file, unless you are simultaneously planning on using more total virtual memory.

    In the Ancient Times, there were systems where the total virtual memory size was equal to the size of the page file. These systems were wasteful of page file space, so the rule of thumb that a pagefile should be twice the RAM was invented.

    In modern days, the old rule is usually not so bad, since systems with a lot of physical RAM tend to have that because a large VM footprint was expected on the system (else why buy so much RAM)? However, as RAM becomes cheaper, I think it is getting a little out of hand (at least for conventional desktop systems). A little bit of a page file is still good, because you will always have allocated VM that is not used for hours or days on end, but a home computer with 512MB of RAM doesn't usually need a gig of page space.

    This is why the Linux system makes a lot of sense. Unless the intended purpose of a machine changes dramatically, or physical RAM is removed, it's usually possible to come up with a good idea of the total amount of paging space needed at install time. If the machine starts running out of VM it is usually better to add RAM than to add swap, anyway.
  • by Anonymous Coward on Friday March 25, 2005 @05:06PM (#12049183)

    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?"

  • by Matthaeus ( 156071 ) on Friday March 25, 2005 @05:08PM (#12049201) Homepage
    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.
  • by snorklewacker ( 836663 ) on Friday March 25, 2005 @05:17PM (#12049286)
    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.
  • Re:Or (Score:1, Insightful)

    by Anonymous Coward on Friday March 25, 2005 @05:18PM (#12049295)
    use linux, you muppets.
    .........
  • by gewalker ( 57809 ) <Gary.Walker@Astr a D i g i tal.com> on Friday March 25, 2005 @05:29PM (#12049370)
    Dude, ever heard of VM/370 [multicians.org]

    or maybe Multics [multicians.org]

    or, more obscure but even earlier Atlas [computer50.org]
  • by The Snowman ( 116231 ) * on Friday March 25, 2005 @05:46PM (#12049614)

    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.

  • by Anonymous Coward on Friday March 25, 2005 @05:48PM (#12049645)
    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.
  • by Malc ( 1751 ) on Friday March 25, 2005 @05:51PM (#12049686)
    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.
  • by networkBoy ( 774728 ) on Friday March 25, 2005 @06:11PM (#12049920) Journal
    I just want to know how a Windows swapfile vs linux swap partition bashing thread turned into abortion rights!
    -nB
  • by Alioth ( 221270 ) <no@spam> on Friday March 25, 2005 @07:05PM (#12050434) Journal
    Umm, the file is called /proc/sys/vm/swappiness; I didn't make it up.
  • by Darren Winsper ( 136155 ) on Friday March 25, 2005 @07:45PM (#12050692)
    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.
  • by real_smiff ( 611054 ) on Friday March 25, 2005 @11:55PM (#12052103)
    i know next to nothing about VM systems, and even *i* can tell we have problems, by this sentence:

    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.

Understanding is always the understanding of a smaller problem in relation to a bigger problem. -- P.D. Ouspensky

Working...