Why Use Virtual Memory In Modern Systems?
Cyberhwk writes "I have a system with Windows Vista Ultimate (64-bit) installed on it, and it has 4GB of RAM. However when I've been watching system performance, my system seems to divide the work between the physical RAM and the virtual memory, so I have 2GB of data in the virtual memory and another 2GB in the physical memory. Is there a reason why my system should even be using the virtual memory anymore? I would think the computer would run better if it based everything off of RAM instead of virtual memory. Any thoughts on this matter or could you explain why the system is acting this way?"
Memory exists to be used. If memory is not in use, you are wasting it. The reality is that your system will operate with higher performance if unused data is paged out of RAM to disk and the newly freed memory is used for additional disk caching. Vista's memory manager is actually reasonably smart and will only page data out to disk when it really won't be used, or you experience an actual low-memory condition.
We who know what we are doing are free to take the risk of running our computers without a swapfile.
Most people are not in a position where they can be sure that they will never run out of physical memory. Because of that, all operating systems for personal computers set up a swapfile by default: It's better for joe average computer owner to complain about a slow system than for him to lose his document when the system crashes because he filled up the physical memory (and there is no swap file to fall back on).
Stop the brainwash
You must be confused about virtual vs. physical memory.
Indeed. When I read this story my knee jerk reaction was "please be gentle." And thankfully the first +5 post on this story is informative and helpful and relatively kind.
... 2 ... 1 ...
I fear the "turn off your computer, put it in a box and mail it back to the manufacturer" hardcore hardware experts that are going to show up in 3
Actually no the author was correct in Microsoft's Windows' terms. This is the exact text used in System Properties -> Advanced tab under Virtual memory:
"A paging file is an an area on the hard disk that Windows uses as if it were RAM."
You might think well they said paging file not virtual memory, well click on Change button and you'll see the dialog pop up named "Virtual Memory" of which you can specify multiple paging files on multiple drives if you wanted to. Defaulted to a single paging file on the C:\ or boot drive. So blame Microsoft for the confusing use of virtual memory and paging file back and forth. I guess they mean by virtual memory as in the collection usage of paging files after the fact (for those situations where there's more than one paging file used, just like on Linux you can have more than one swap file in use).
Anyway, I too have seen Windows 2000 and XP just love to make heavy use of the paging file even though there is clearly enough physical memory available. Some friends of mine have even disabled Windows from using a paging file completely, at first you will get a warning about it, but other than that they have reported better system performance and no draw backs noticed since then. This is on systems with at least 3GB of RAM.
This space is not for rent.
This should generate some polarized discussion.
There are two camps of thought.
One will insist that, no matter how much memory is currently allocated, it makes more sense to swap out that which isn't needed in order to keep more free physical ram. They will argue until they are blue in the face that the benefits of doing so are good.
Essentially - your OS is clever and it tries pre-emptively swap things out so the memory will be available as needed.
The other camp - and the one I subscribe to - says that as long as you have enough physical ram to do whatever you need to do - any time spent swapping is wasted time.
I run most of my workstations (Windows) without virtual memory. Yes, on occasion, I do hit a "low on virtual memory error" - usually when something is leaky - but I prefer to get the error and have to re-start or kill something rather than have the system spend days getting progressively slower, slowly annoying me more and more, and then giving me the same error.
This is not to say that swap is bad, or that it shouldn't be used - but I prefer the simpler approach.
One word: Multics. Way too far ahead of its time. Those who forget history will have to try to re-invent it. Badly.
What would you do instead of file save? Continuous save, where the file data is saved as you type? What if you decide the changes you made were a mistake? I think one of the basic premises, going a very long way back in the design of software, is that you don't immediately save changes, so that the user can make a choice whether to 'commit' the changes, or throw them away and revert back to the original state of the file. As far as I know, Notepad will only temporarily stop the shutdown of the computer, to ask you do you want to save the file - yes/no? I don't see how that is such a bad thing?
Now, you might say that the solution for this is automatic file versioning. The problem is that if you have continuous save, you would either get a version for every single character typed, deleted, etc, or else you would get 'periodic' versions (like, a version from 30 seconds ago, a version from 30 seconds before that, etc) and pretty soon you'd have a ridiculous number of 'intermediate' versions. File versioning should, ideally, only be saving essentially 'completed' versions of the file (or at least, only such intermediate versions as the user chooses to save [because, if you are creating a large document, like a Master's Thesis, or book, you will probably not create it all in a single session, so in that case, you might have versions which don't correspond to completed 'final products', but you probably also don't want 1000 different versions either], instead of a large number of automatically created versions).
Whether or not it works (and I'm not sure how well it does), there's something odd about swapping out RAM contents to disk so that you can mirror disk contents in RAM.
No, I don't think the OP is confused.
Back in the days of mainframes only, say before 1980 or so, all the systems I worked on (NCR, IBM and Burroughs) used the term "virtual memory" to refer to secondary memory storage on a slower device. Early on the secondary device was CRAM (Card Random Access Memory) and later it was disk.
But the point is that Virtual Memory originally referred to main memory storage on a secondary device. Furthermore, this is still the term used for paged storage in Microsoft Windows. Check out the Properties page on the "Computer" menu item on Vista or "My Computer" icon on XP which talks about Virtual Memory when setting the size of the paging file.
The OP is totally correct in his use of Virtual memory both by historical precedent and by current usage in Windows.
You'd have thought after all this time they could've corrected one of the most annoying "features" which stops me using Windows for any amount of time? It certainly appears like after X amount of inactivity (whatever it may be classified as) stuff just gets swapped out even if you have enough physical memory!
Considering the way I normally work is to have many applications open, perhaps an IDE, a handful of terminals, a web browser, e-mail client, then spend X amount of time with one application, then switch to another (test/deploy/whatever), then maybe check e-mail & web, by the time I get around to switching to my next task the previous applications have at least partially been swapped to disk.
When I was using Windows at work, by the end of each day I was getting so incensed by it'd be a big hands in the air and muffled swearing whenever it happened, a total productivity killer.
Lets just say I'm back in Linux & Solaris land now, I have almost the same set of applications open with no problems - and that's on top of running my testing environment on the same machine.
What you do realize is 99% of the human population is dumber than headless chickens.
Most people are not incredibly knowledgeable about computers. There's a big difference. Pretty much everyone is very good at something. That's why some people get paid to sell merchandise, design hardware, repair engines, cook food, synthesize chemicals, or perform surgery, and others get paid to solve computer problems.
"...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
When did Microsoft go into the disk drive business ?
Go spread your anti-ms bs somewhere else please.
I'm fine with folks not knowing about computers. That's cool. The thing that annoys me, though, is that they're /proud/ of it. Its like its a badge of honor! Any sort of discussion about computer issues will always bring up some yahoo who says "Oh, I don't know a /thing/ about that! hur hur, in my day, all we had was pen and paper..." etc etc etc. The fact is, knowledge - basic knowledge - of computers is only going to get more important. Hiding your head under a rock isn't going to magically make it go away.
And its not the age thing, either - I've got a friend who is in his 70's, and his knowledge of technical things is way up there - he's a pure linux guy, uses myth to serve TV content all around the house, and is a very active member in the local unix club. Some people just don't seem to want to learn the basics.
Part of it too is that *everybody* has their stupid moments. The kind where, afterward, you realize just how dumb you were. Some like to pretend they've never been guilty of it, but they're often the worst offenders. (Same goes for doing asinine things while driving.)
Never going to happen.
When cars were first sold to the public, if you bought one you'd damned well better know how to fix it yourself. Fast forward to now. Plenty of idiots still buy cars and are completely fucked when it comes time to do something as minor as changing the oil or spark plugs. </gratuitous car analogy>
That's around a hundred years of people refusing to learn really simple shit. What makes you think it will be different with computers over a shorter timespan?
Violence is like duct tape. If it doesn't solve the problem, you didn't use enough.
Actually, that may be politically correct, but it's not true.
Sure, everyone has strong and weak sides, but nevertheless, the tendency is for some people to know a lot about a huge array of topics, and other people being pretty unknowledgeable about pretty much everything.
That nobody can specialize in everything is however true.
You do need one surgeon, and a different cryptographer, true. But still, the odds is that either of them will know more about the basics of the work of the other than a random person you ask on the street.
Ummm... no. There are a statistically significant number of humans who aren't notably good at anything. I have unhappily encountered too many of them, both in and out of tech work. This is akin to actually believing that "all men are created equal" merely because it would be really really neat and make you feel all warm-and-fuzzy inside if it were true.
Even if your pollyanna perspective was true, being competent at some task doesn't directly equate with an absence of dumbassery. There are numerous species of "dumb" creatures that can be trained to memorize some task and then mimic (repeat) it perfectly ad nauseum... including H. sapiens. An ability to memorize and mimic doesn't equate directly with intelligence. It's a precursor, a prerequisite, perhaps, but not the Real McCoy.
A shocking number of humans, including many regarded as "average" by testing standards, never actually reach a state of true intelligence. Too many of them are profoundly ignorant and quite determined to remain that way.
Uh, no. When cars were FIRST sold to the public, if you bought one you could afford to pay one of your servants to maintain it.
Besides, that's still a bad analogy, because it's not that most people couldn't change the oil or spark plugs on a car, it's just that it's too much of a pain in the ass for people to do it. I could teach anyone how to do it in theory. You just follow a few simple steps. But it's much easier to simply pay a guy 25 bucks every couple of months than have to crawl under the car, muck around with dirty oil, figure out where to dispose the old stuff, and so on. Given that, there's not really any real need for me to know how to do it, any more than I need to know how to perform surgery or cook escargot. Although in point of fact I do know how to change the oil on my car (having changed the oil on numerous motorcycles purely for the fun of it), I see no reason to call anyone who didn't have a clue how to do it an idiot.
Computers are getting simpler. They are getting to the point where it makes sense to learn how to use them and how to fix them when something minor goes wrong. This is the standard level for computer literacy. A better car analogy would be to observe that when cars were first sold to the public, they were complicated to operate, difficult to start, and not many people saw the use of them. Over time, however, they became simpler and simpler, to the point where it is reasonably expected that any given adult will be able to drive a car. This is what is increasingly happening with computers. Some from the older generations will learn to adapt to the new technology, and some will not. But within our lifetimes, computer competence will be expected of people, especially when computers have become simple and ubiquitous. To an extent, this is already the case. However, the general expectation is not that anybody could write software (i.e. design a car part) or be able to fix computers that have suffered a serious malfunction (i.e. replace the cooling system). It's not even be that most people are expected to be able to handle routine maintenance on their own, hence the need for automatic software updates--you don't need to understand the details, just that you need to do it every so often. Just like changing your car's oil.
Ummm... no. There are a statistically significant number of humans who aren't notably good at anything.
to be more precise a lot of people are not good at anything that we know and value, they could be good at stupid things (soccer strategy) and never know it, never make others know and certainly never apply it to something good.
but teoretically anyone could have some bright (but unuseful/unused) capacity.
There are numerous species of "dumb" creatures that can be trained to memorize some task and then mimic (repeat) it perfectly ad nauseum... including H. sapiens. An ability to memorize and mimic doesn't equate directly with intelligence. It's a precursor, a prerequisite, perhaps, but not the Real McCoy.
you forget a prerequisite of intelligence evolution, THE NEED FOR IT.
if they could live their lives in a dumb way many lazy person never try to reach an higer lever of intelligence, never ever feel their lack of it!
A shocking number of humans, including many regarded as "average" by testing standards, never actually reach a state of true intelligence. Too many of them are profoundly ignorant and quite determined to remain that way.
the deepnes of their ignorance is an huge problem because they never perceive their ignorance, and many of the few that perceive it refuse to believe it and assault the condition that make them feel stupid.
that is the sad problem.
Does this happen in USA a lot? if a light in the fridge goes out, do you buy a new one? when a tire is blown out, do you buy a new car?
Gee, and then some people wonder why Americans spend 50% of the global resources...