×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Why Use Virtual Memory In Modern Systems?

timothy posted more than 5 years ago | from the virtually-useless dept.

Windows 983

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

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

983 comments

You mean physical memory right :-) (5, Informative)

alain94040 (785132) | more than 5 years ago | (#25995059)

You must be confused about virtual vs. physical memory. In modern processors, there is no penalty for using virtual memory, all translation from virtual to physical address space is done internal to the processor and you won't notice the difference.

So all the physical memory installed in your PC is used by the processor as one big pool of resources. Processes can think whatever they want and address huge memory spaces, that's all in virtual land. Virtual memory only starts impacting performance when pages are being swapped in and out, because all your processes need more resident memory than you actually have.

Swapping means accessing the disk and freezing the requesting process until its page of memory has arrived from the disk, which takes millions of processor cycles (a lifetime from the processor's point of view). It's not so bad if you swap once, as the processor can work on other processes while waiting for the data to arrive, but if all your programs keep pushing each other out of physical memory, you get thrashing and consider yourself happy if the mouse pointer is still responsive!

So you may want to change the title of your post to: "why use physical memory in modern systems?". I would point you to an article I wrote on that topic in 1990, but somehow I can't find a link to it on the web :-)

fairsoftware.net - software developers share revenue from the apps they build

Re:You mean physical memory right :-) (5, Insightful)

Anonymous Coward | more than 5 years ago | (#25995173)

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.

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 ... 2 ... 1 ...

Re:You mean physical memory right :-) (5, Funny)

alain94040 (785132) | more than 5 years ago | (#25995447)

Gentle answers is what 6 years in customer support teaches you.

That, or hating everyone ;-)

Re:You mean physical memory right :-) (2, Funny)

Anthony_Cargile (1336739) | more than 5 years ago | (#25995205)

Either he/she (wait, this is /.) thinks "Virtual Memory" is the same thing as paging, or thinks it is the reason the computer is slow with even those specs, not taking into consideration the operating system...

Virtual Memory v Paging (5, Informative)

clarkn0va (807617) | more than 5 years ago | (#25995423)

thinks "Virtual Memory" is the same thing as paging...

Mac Classic (OS 8 for sure) used the term "Virtual Memory" the same way Windows today uses "Page File" or unix uses "swap", so you can at least understand why some people might be confused by this.

db

Re:Virtual Memory v Paging (0, Redundant)

Anthony_Cargile (1336739) | more than 5 years ago | (#25995477)

Too bad he isn't using Mac OS Classic otherwise I would not recommend placing the computer in a box, mailing it to the OEM and never touching a computer again.

(See a couple of posts above ;))

Re:You mean physical memory right :-) (4, Funny)

brxndxn (461473) | more than 5 years ago | (#25995209)

So do I really only need 640k of physical memory if I have a modern system?

Re:You mean physical memory right :-) (5, Insightful)

TypoNAM (695420) | more than 5 years ago | (#25995255)

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.

Re:You mean physical memory right :-) (5, Informative)

TypoNAM (695420) | more than 5 years ago | (#25995551)

Sorry, got to correct the path to where exactly I got that quote from:
System Properties -> Advanced -> Performance area, click Settings -> Advanced tab (on Windows XP, as for 2000 its the default tab).

rephrasing his question charitably... (5, Interesting)

Trepidity (597) | more than 5 years ago | (#25995273)

I'd assume what he's asking is: in modern systems where the amount of physical RAM is considerably larger than what most people's programs in total use, why does the OS ever swap RAM out to disk?

The answer is basically to free up RAM for disk cache, based on a belief (sometimes backed up by benchmarks) that for typical use patterns, the performance hit of sometimes having to swap RAM back into physical memory is outweighed by the performance gain of a large disk cache.

Of course, OS designers are always revisiting these assumptions---it may be that for some kinds of use patterns using a smaller disk cache and swapping RAM out to disk less leads to better performance, or at least better responsiveness (if that's the goal).

Re:rephrasing his question charitably... (4, Informative)

jandrese (485) | more than 5 years ago | (#25995481)

Man, I hated that assumption in 2000, and I hate it in XP. It's the one that means when you bring Firefox up after it has been minimized, that the OS will have to laboriously swap in all of the memory for it from disk, which takes forever when you're talking about a slow laptop hard drive. I made it a habit of switching the paging file management to "manual" and reducing the paging size down to 2mb. It makes the whole system way more responsive when you're like me and have a bunch of applications open at once and in the background, and memory is so cheap that buying a little extra so you never run out (2GB) is easy.

Knock Off The Spam (-1, Flamebait)

Anonymous Coward | more than 5 years ago | (#25995535)

Drop the adline, douchebag. If I wanted to see retards hawking Amazon affiliates I'd have signatures turned on -- and I don't. Because I don't like them. And I don't like you.

Memory exists to be used (5, Insightful)

Alereon (660683) | more than 5 years ago | (#25995061)

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.

Re:Memory exists to be used (5, Interesting)

etymxris (121288) | more than 5 years ago | (#25995227)

I've known this argument for many years, I just don't think it applies anymore. The extra disk cache doesn't really help much, and what ends up happening is that I come in to work in the morning, unlock my work XP PC, and I sit there for 30 seconds while everything gets slowly pulled of the disk. XP thought it would be wise to page all that stuff out to disk, after all, I wasn't using it. But why would I care about the performance of the PC when I'm not actually using it?

At the very least, the amount of swap should be easily configurable like it is in Linux. I haven't actually used a swap partition in Linux for years, preferring instead to have 6 or 8gb of RAM, which is now cheap.

Re:Memory exists to be used (3, Insightful)

ivan256 (17499) | more than 5 years ago | (#25995331)

What you're actually complaining about is that Windows did a poor job of deciding what to page out. Sure, you could "turn off swap" if you have enough memory, and you won't ever have to wait for anything to be paged in.. But your system would be faster if you had a good paging algorithm and could use unaccessed memory pages for disk cache instead.

Re:Memory exists to be used (1)

etymxris (121288) | more than 5 years ago | (#25995409)

To do it well, Windows would have to know what I was going to use before I started using it. I'd rather just use the extra physical memory than have my operating system try to figure when I'm going to come in in the morning or when I'll decide to hit the IDE or email client again.

Re:Memory exists to be used (2, Interesting)

mea37 (1201159) | more than 5 years ago | (#25995509)

I think you might have awfully high expectations of the paging algorithm, if you think it's "bad" because it paged out data that wasn't being used for something like 16 hours.

Perhaps the problem is that the cost/benefit values of "keep an app that isn't being touched in RAM" vs. "increase the available memory for disk caching", while they may be appropriate when the computer is actually being used, are not optimal for a computer left idle overnight. The idle computer has a higher-than-expected cost (in terms of user experience) associated with paging the idle app, and a lower-than-expected benefit to increasing the cache size.

Re:Memory exists to be used (4, Informative)

Timothy Brownawell (627747) | more than 5 years ago | (#25995389)

At the very least, the amount of swap should be easily configurable like it is in Linux. I haven't actually used a swap partition in Linux for years, preferring instead to have 6 or 8gb of RAM, which is now cheap.

It is, (Right-click "My Computer")->Properties, "Advanced" tab, "Settings" under Performance, "Advanced" tab, "Change" under "Virtual memory". Almost as easy as "dd if=/dev/zero of=swapfile bs=1G count=1; swapon swapfile", spclly if u cant spel cuz u txt 2 much.

Re:Memory exists to be used (-1)

Anonymous Coward | more than 5 years ago | (#25995427)

XP pages out to a disk after a while for at least these reasons.
First, if you decide to hibernate, everything is already on disk, and you can shutdown that much more quickly.
Second, it helps with crash recovery (say like if your laptop runs out of batteries).
You don't really want data in two places (one in physical memory and one copy on the disk VM), since by definition, one copy is "dirty". However, MS has to create an algorithm for balancing recovery versus performance.

Incidentally at least until XP, you can still set your VM to zero if you want to force everything to run in physical memory. However, you will probably find there is a heavy price to pay for the performance boost.

Re:Memory exists to be used (0)

Anonymous Coward | more than 5 years ago | (#25995357)

That's pretty shortsighted. It's like saying if your hard drives aren't all completely filled to the brim, then you are wasting it.

The reason I don't want all of my RAM being used is because I know much further in advance than the computer does about when more RAM will be needed and by which specific applications. If that memory is being hoarded by unneeded crap, then my important tasks suffer.

Re:Memory exists to be used (1)

Alereon (660683) | more than 5 years ago | (#25995593)

The reason I don't want all of my RAM being used is because I know much further in advance than the computer does about when more RAM will be needed and by which specific applications. If that memory is being hoarded by unneeded crap, then my important tasks suffer.

The Windows memory manager knows far more than you do about your system's memory utilization and how to optimally allocate the available physical memory. The disk cache data can be purged without delay if that memory is needed by an application, so it's not like you have to wait for memory to be freed up before it can be used. The only case in which there can be a negative performance impact is if the system does end up paging out data an application needs, which is rather unlikely. The only way I've been able to cause a performance problem with the Windows XP memory manager was with heavy Bittorrent seeding over a period of hours, the system would see the constant disk I/O and prioritize more RAM for the disk cache. I used a third party program to modify the disk caching settings to prevent this problem. Alternatively, I could have not been seeding a hundred Linux ISOs. I haven't been able to reproduce this performance loss in Vista.

Re:Memory exists to be used (1)

SnarfQuest (469614) | more than 5 years ago | (#25995471)

Another thing to consider. When you start a program using virtual memory, only the pages of the program that get executed are pulled off the disk. This reduces disk accesses, and leaves more memory available for caching.

Also, if several instances of a program are being executed, or several references to a library, the common code between them is not duplicated in memory. The virtual memory system just points the processes to the same binary code. This causes even more memory savings and disk access reductions.

Re:Memory exists to be used (1)

aliquis (678370) | more than 5 years ago | (#25995475)

Exactly, you want virtual memory because you want you ram available / usable by the applications which would benefit the most from it and not by whatever happened to allocate it first.

Re:Memory exists to be used (2, Informative)

amliebsch (724858) | more than 5 years ago | (#25995499)

Are you sure? I was under the impression that Vista aggressively pages out when it thinks it can do it without impacting system performance, but will utill keep the page in RAM. That way the RAM can be quickly freed and used for other processes if needed (i.e., large programs can start quickly), and the disk page ignored and overwritten (ultimately never helping but never hurting much either) if it is ultimately never used.

Agreed (4, Interesting)

Khopesh (112447) | more than 5 years ago | (#25995575)

Linux kernel maintainer Andrew Morton sets his swappiness [kerneltrap.org] to 100 (page as much physical memory as you can, the opposite of this Ask-Slashdot's desires), which he justified in an interview (see above link) by saying:

My point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don't want hundreds of megabytes of BloatyApp's untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful.

Of course, there's another view, also presented at the above kerneltrap article: If you swap everything, you'll have a very long wait when returning to something you haven't touched in a while.

If you have limited resources, milk the resources you have plenty of; workstations should have high swappiness while laptops, who suffer in disk speed, disk capacity, and power, are probably better suited with lower swappiness. Don't go crazy, though ... swappiness = 0 is the same as running swapoff -a and will crash your programs when they need more memory than is available (as the kernel isn't written for a system without swap).

Virtual Memory or Paging (4, Informative)

Anonymous Coward | more than 5 years ago | (#25995077)

Virtual memory [wikipedia.org] is very useful.

Note that "virtual memory" is not just "using disk space to extend physical memory size".

Re:Virtual Memory or Paging (3, Informative)

Dadoo (899435) | more than 5 years ago | (#25995605)

I think I'm going to need to add a comment to that Wikipedia page. I'm not sure when the definition changed, but a long time ago (mid 80s), "virtual memory" did mean "making a program believe it had more memory than there was on the system". At least three different vendors defined it that way: Motorola, Data General, and DEC. I still have the Motorola and DG manuals that say so.

Vista reserves 1 GB (-1, Troll)

Anonymous Coward | more than 5 years ago | (#25995083)

Vista reserves 1 GB to itself, so your system will only ever have 3 GB available for processes.

Re:Vista reserves 1 GB (5, Informative)

El Lobo (994537) | more than 5 years ago | (#25995153)

Absolutely not true. You can even install and run Vista on a computer with 1Gb ram and no page file. And run applications. So it doesn't reserve 1Gb for itself and thus, your myth is busted. Vista's memory manager will use as much memory it can (free memory is a waste, so it will use it rather than watch it empty). But as soon as a process needs memory it will give it back.

Re:Vista reserves 1 GB (-1, Troll)

Anonymous Coward | more than 5 years ago | (#25995339)

You can even install and run Vista on a computer with 1Gb ram and no page file. And run applications. So it doesn't reserve 1Gb for itself and thus, your myth is busted.

No you can't. Microsoft doesn't even claim to support such a ridiculously limited configuration, and you've clearly never tried it yourself, and thus, your myth is busted.

Take your astroturfing elsewhere.

Re:Vista reserves 1 GB (1)

Anonymous Coward | more than 5 years ago | (#25995495)

system requirements [microsoft.com] check it out seems that premium business and ultimate both support 1gig and the other support 512 so wtf are you smoking? Of course I would recommend that you use more than that but it still will run which debunks the OP.

Re:Vista reserves 1 GB (5, Informative)

d3vi1 (710592) | more than 5 years ago | (#25995555)

I think he is referring to the userspace/kernelspace split in Windows NT. On 32bit Windows XP, by default, the userspace (ring3) will have at most 2 GB of the physical RAM, and the kernel space would get the rest (some of it paged and some of it not). On systems with more than 3G of RAM (a lot by 2002 standards), it was kinda pointless to reserve that much for the kernel space, so they added a boot.ini flag that changed the split to _AT_MOST_ 3GBytes for the userspace and the rest for kernel space.
In Vista the split for 3G/1G of RAM is default. Actually on a system with 4G of RAM running in 32bit mode, you can't use all of them even if you try (in Windows XP), because right under the 4G limit you would have the PCI memory address mappings, that can be as large as 512M for a common video card with half a gig of RAM. Add to that the RAID controllers and the other hardware, and you have about 800megs of RAM unused because they can't be addressed, as their address-space is used by the installed devices.
I think that http://support.microsoft.com/kb/823440/ [microsoft.com] and http://support.microsoft.com/kb/171793/ [microsoft.com] should describe what I'm talking about pretty clearly.

Re:Vista reserves 1 GB (0)

Anonymous Coward | more than 5 years ago | (#25995607)

Windows splits the 32-bit process address space in half; 2GB for kernel-mode and 2GB for user-mode. There is a switch to change this to 1GB kernel-mode and 3GB user-mode. This is probably where the "reserves 1 GB for itself" myth comes from. Obviously we are talking about virtual memory here, so there is no hard physical memory requirement of 1GB. At some point you are going to run out of physical memory (512MB? 256MB? 128MB?), but I suspect 1GB would be sufficient for many uses.

Re:Vista reserves 1 GB (0)

Anonymous Coward | more than 5 years ago | (#25995355)

Vista for me idles fresh boot at about 300-400mb. When you see large spikes it's probably prefetching applications and loading them into ram. This way when you go to load world of warcraft every day at 5:30pm it takes a fraction of the time on the initial load. The memory used to store prefetched applications appears as part of "windows' memory" before being loaded so it can make it seem like windows vista is actually using 1gb when in fact most of that is WoW, or Photoshop, or Counterstrike, etc.

Re:Vista reserves 1 GB (0)

Anonymous Coward | more than 5 years ago | (#25995405)

Do you mean that vista requires 1GB for loading all of it's libraries? Because I thought if you turned off services you don't need and Aero you could get it well under that.

If it actually reserves 1GB no matter what then...link or better explanation?

Re:Vista reserves 1 GB (2, Informative)

clarkn0va (807617) | more than 5 years ago | (#25995501)

Vista reserves 1 GB to itself, so your system will only ever have 3 GB available for processes.

Not exactly. 32-bit OSes won't normally report more than about 3.2 GiB of system RAM, as a 32-bit OS can only address 4 GiB (PAE/himem aside), and the upper addresses are reserved for hardware.

64-bit OSes (even Vista) will use and report RAM to much higher upper limits.

Or something like that.

Re:Vista reserves 1 GB (0)

Anonymous Coward | more than 5 years ago | (#25995547)

That's not true at all, it requires 700 Meg for the system and 300 meg for addition extras.

The real answer is (5, Funny)

Ethanol-fueled (1125189) | more than 5 years ago | (#25995089)

Virtual memory and pagefiles still exist so that there will be persistent, recoverable storage of your browsing and search history, illegally downloaded music, and furrie porn should anybody come a-knockin after you hit the power switch.

[/tinfoil hat]

Re:The real answer is (2, Funny)

eldavojohn (898314) | more than 5 years ago | (#25995431)

Virtual memory and pagefiles still exist so that there will be persistent, recoverable storage of your browsing and search history, illegally downloaded music, and furrie porn should anybody come a-knockin after you hit the power switch. [/tinfoil hat]

</worrying> You're close but do you know why I only drink rain memory and grain memory, Mandrake? It's because virtual memory and pagefiles are the greatest Communist conspiracy to sap and impurify our precious computerly processes. <love the bomb>

First (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#25995113)

First!

Re:First (-1)

Anonymous Coward | more than 5 years ago | (#25995363)

It's a shame there isn't a '-1 Fail (and Offtopic)' mod...

Modern Systems? (2, Funny)

Anonymous Coward | more than 5 years ago | (#25995117)

Are you asking about modern systems or Windows?

Would it help if (5, Funny)

Xerolooper (1247258) | more than 5 years ago | (#25995121)

you could create a RAM Disk and set your page file to use that.
Then all your virtual memory is in RAM.
I'll leave it to someone else to explain why that isn't a good idea.

Re:Would it help if (5, Interesting)

Changa_MC (827317) | more than 5 years ago | (#25995385)

I know it's not a good idea now, but this was seriously a great trick under win98. Win98 Recognized my full 1GB of RAM, but seemed to want to swap things to disk rather than use over 256MB of RAM. So I just created a RAM disk using the second 512MB of RAM, and voila! Everything ran much faster. When everything is broken, bad ideas become good again.

Not just a funny (1)

EmbeddedJanitor (597831) | more than 5 years ago | (#25995397)

With earlier versions of XP Embedded you had to provide a block device for paging, which is pretty stupid in an embedded system. Some people subverted this by hiding some RAM from the OS and making it available as a "disk".

You also had to provide a display driver, even for devices with no display. Same deal, make a "fake one".

Turn it off, then! (5, Insightful)

Jeppe Salvesen (101622) | more than 5 years ago | (#25995131)

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).

Re:Turn it off, then! (-1, Troll)

jon3k (691256) | more than 5 years ago | (#25995179)

Who said anything about a swapfile? We're talking about virtual memory [wikipedia.org].

"Note that "virtual memory" is not just "using disk space to extend physical memory size"."

Re:Turn it off, then! (3, Interesting)

Xerolooper (1247258) | more than 5 years ago | (#25995235)

Urg... must... not... feed... trolls...
You can infer from the OP what he was talking about. Oh dammit!

Re:Turn it off, then! (1)

Jeppe Salvesen (101622) | more than 5 years ago | (#25995263)

I think it's pretty obvious the poster is a bit confused about the terms. I just went along with the poster's terminology in order to explain why rather than inform him he's an idiot. :)

Re:Turn it off, then! (1)

jon3k (691256) | more than 5 years ago | (#25995609)

If that was in fact the case, you might want to start the conversation by clearly defining the terms. Unless you were also confused about the difference between paging and virtual memory, but I'm sure that wasn't the case. ;)

Re:Turn it off, then! (1)

Chemisor (97276) | more than 5 years ago | (#25995463)

> Most people are not in a position where they can be sure that they will never run out of physical memory.

If you can fill 4GB of physical memory, you can fill your swap file just as quickly, and then your apps will crash anyway. So really, this is not a good argument. You can run out no matter how much you allocate. The right question to ask is what happens when you do, and that is that the process that is filling all that memory will be killed. Unless you are using OpenOffice, I highly doubt that that process will be your word processor.

Why use a file system? (4, Interesting)

chrylis (262281) | more than 5 years ago | (#25995133)

The other extreme point of view is that modern systems should only have virtual memory and, instead of having an explicit file system, treat mass storage as a level-4 cache. In fact, systems that support mmap(2) do this partially.

The idea here is that modern memory management is actually pretty good, and that it's best to let the OS decide what to keep in RAM and what to swap out, so that issues like prefetching can be handled transparently.

Re:Why use a file system? (1)

MichaelSmith (789609) | more than 5 years ago | (#25995247)

Hmm thats interesting. Kind of a palm pilot way of doing things on a larger scale. I imagine you would need something like a file system (or the palmos database) in shared memory so that data could actually be moved around, but maybe that should be more of a distributed middleware layer.

Re:Why use a file system? (3, Funny)

Anonymous Coward | more than 5 years ago | (#25995277)

Modern like the IBM System 38 circa 1980?

Re:Why use a file system? (2, Interesting)

mindstrm (20013) | more than 5 years ago | (#25995457)

Because currently, modern systems leak. A cold re-start puts things back into a fresh state - and we need that.

Modern memory management is fantastic - but I'll still arguet hat my workstations work better and smoother with swap disabled than without it - which is telling.

Multics (4, Insightful)

neongenesis (549334) | more than 5 years ago | (#25995597)

One word: Multics. Way too far ahead of its time. Those who forget history will have to try to re-invent it. Badly.

Mental Note (0, Flamebait)

jon3k (691256) | more than 5 years ago | (#25995137)

Mental Note: Slashdot Editor Timothy doesn't know the difference between paging memory to disk and virtual memory.

Re:Mental Note (0)

Anonymous Coward | more than 5 years ago | (#25995185)

Of course, your post will be modded down as flamebait or something -- but this kind of stuff is pretty important.

Ask Slashdot is a cesspool nowadays. People ask questions that are either misleading, obvious, or just plain don't make sense. And somehow they get through the editors onto the front page.

It's not really respectable IT journalism.

Re:Mental Note (0)

Anonymous Coward | more than 5 years ago | (#25995365)

It is sensationalist tripe.

In this instance, you have one guy who knows a little too much and just found Task Manager, one of those "power users." You know, the type that guffaw-guffaw endlessly about Microsoft and how inept they are, the subtext being they could do better if they wanted to. But they never seem to realize they don't know what they're talking about oftentimes.

This sort of ignorance shouldn't make it to the front page, it just validates it.

Re:Mental Note (0)

Anonymous Coward | more than 5 years ago | (#25995493)

See comment above to bust your self-important blustering

http://slashdot.org/comments.pl?sid=1051583&cid=25995255

File - Save (4, Interesting)

Anonymous Coward | more than 5 years ago | (#25995145)

For that matter, why do we even need to explicitely "save" anymore? Why does the fact that Notepad has 2KB of text to save prevent the shutdown of an entire computer? Just save the fecking thing anywhere and get on with it! Modern software is such a disorganized mess.

Re:File - Save (1)

Kral_Blbec (1201285) | more than 5 years ago | (#25995541)

Might not be a bad idea, except that when you wanted to find it again you wouldnt have a clue. Okay, maybe YOU would. My mom and the zillion jillion other users like her wouldn't though. So its not just an issue of having enough space to save it, its also helping the user know where to look for it when they want it back next time.

Its the Page Replacement, not Virtual Memory (2, Informative)

nleaf (953206) | more than 5 years ago | (#25995151)

The problem is whatever Vista is using for page replacement, not virtual memory itself. Let's say you're using 2 GB of physical memory, and then start up some memory-intensive program that uses another 2 GB. You're done; if you run out of space now, the OS can do nothing about it, and is forced to do something drastic like start killing off processes.

The question then is why isn't Vista making fullest use out of virtual memory? It is probably trying to proactively move little used pages out of physical memory to make space for new pages. Its an attempt at optimization--after all, if you're not using that data, why let it take up valuable physical memory?

Anonymous Coward (0)

Anonymous Coward | more than 5 years ago | (#25995167)

Its Vista. Thats a feature ;)

OP seems to be confusing two concepts (-1, Redundant)

Anonymous Coward | more than 5 years ago | (#25995175)

Namely, the usage of the swap file vs. the need for virtual memory. Before we can have any discussion, he should start by learning the difference. Usually virtual memory is implemented with a swap file that is used if necessary.

Try turning off the swap file entirely (0)

Anonymous Coward | more than 5 years ago | (#25995189)

Windows really sucks at managing large amounts of memory. I hit this all the time, where I start a build of my project, then I click in a web browser window and I have to wait 10 seconds for Windows to page back in the pages that it "helpfully" swapped out with no fucking benefit to me whatsoever. These days, disk I/O is an insanely bad bottleneck on all the Windows machines that I actually use for stuff. Paging is just another useless thing competing for my available I/O bandwidth and imposing a ridiculous latency on me whenever I switch to an app I haven't used for a while.

The only reason I haven't turned off my swap file is that I sometimes need to have more stuff running than RAM I actually have.

Virtual memory != Swap (0)

Anonymous Coward | more than 5 years ago | (#25995217)

The virtual memory system is not just used for swap. Instead of loading whole files into memory, the system can map the file into the address space and only load the pages which the program actually accesses. This file then becomes "virtual memory" and this way of doing it is faster than not using the virtual memory system. That's why you should always keep virtual memory enabled, even when you have enough RAM.

I don't know about Vista's paging implementation.. (3, Informative)

JonLatane (750195) | more than 5 years ago | (#25995223)

But, at least in Mac OS X, exited processes consume "inactive" memory - basically being kept in memory until they are launched again. If Vista has a similar implementation, your swapfile may just contain a bunch of pages left over from previously-running applications. Are you experiencing actual system performance problems? Concerning yourself too much with the numbers only can be a bad thing.

Re:I don't know about Vista's paging implementatio (1)

darrenkopp (981266) | more than 5 years ago | (#25995591)

Concerning yourself too much with the numbers only can be a bad thing.

stop attacking my poor numbers! what did they ever do to you?

The semantics of 'Virtual Memory' (1)

Morgon (27979) | more than 5 years ago | (#25995231)

Note that in Windows-based machines, 'Virtual memory' is synonymous with the Page (swap) file.

Therefore, the OP is wondering why this needs to be the case at all, and it's a good question, as Windows always seems to enjoy using the disk when there's perfectly good RAM available.

I've forced my system to use no paging file, which greatly increases performance. However, any faults in your memory will show up more frequently (as is the case for me when I'm using a large portion of my RAM -- but not enough to get new sticks just yet :P )

Re:The semantics of 'Virtual Memory' (1, Funny)

Anonymous Coward | more than 5 years ago | (#25995375)

You sir, are a morgon!

Re:The semantics of 'Virtual Memory' (1)

mindstrm (20013) | more than 5 years ago | (#25995379)

Which is something I prefer - I'd rather see problems earlier, and know about leaky applications earlier, rather than endure an ever-slowing computer until finally it crashes.

It's going to do the same thing either way, one is just more annoying.

Re:The semantics of 'Virtual Memory' (1)

duplicate-nickname (87112) | more than 5 years ago | (#25995455)

Interesting, so failing memory doesn't effect the system cache. That is some magical hardware you have there.

Lemme get dis stait... (1, Flamebait)

crovira (10242) | more than 5 years ago | (#25995253)

You're using Windows 64 ultimate and it seems slow on 4GB?

Well of course. Its Microsoft.

Why use swap? (0, Redundant)

NecroBones (513779) | more than 5 years ago | (#25995267)

I think the more relevant question is why use swap if you have enough ram? If you're 100% certain that everything you do will always fit inside physical memory, technically you can do away with swap. I'm not sure how Windows will deal with this however.

VM is a many splendour'd thing. (1)

ettlz (639203) | more than 5 years ago | (#25995301)

Is there a reason why my system should even be using the virtual memory anymore?

Yes, for memory protection. Oh, you mean swap. Well,

I would think the computer would run better if it based everything off of RAM instead of virtual memory.

not everything mapped into a process's address space is in constant use. Swap it out, use the RAM for...

Any thoughts on this matter or could you explain why the system is acting this way?

...the storage cache.

More than just memory management (4, Interesting)

frog_strat (852055) | more than 5 years ago | (#25995317)

Virtual memory is now used for little tricks, in addition to providing more memory than is physically available.

One example is ring transitions into kernel mode which start out as exceptions. (Everyone seems to have ignored call gate, the mechanism Intel offered for ring transitions).

Another is memory mapped pointers. It is cool to be able to increment a pointer to file backed ram and not have to care if it is in ram or not.

Maybe the OP is onto something. Imagine writing Windows drivers without having to worry about IRQL and paging.

The problem is windows (0)

Anonymous Coward | more than 5 years ago | (#25995341)

The algorithms in windows that decide when and what to page to disk are fucking insane. No matter what it will always do that. We have a vista64 box with 16gigs of ram and - surprise the same shit! I've tried to disable swap altogether and it just can't be done in 'doz. It will for instance turn it back on, or give crazy errors.

I prefer none. (5, Insightful)

mindstrm (20013) | more than 5 years ago | (#25995343)

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.

Use the RAM where it's needed. (1)

Canonical AC (884705) | more than 5 years ago | (#25995367)

The operating system will page out pages that have never been used, or used very infrequently, if at all.
 
If you have a 6MB program, and there is 500K of code that's used on startup, but never referenced again, let the operating system page it out, and use that RAM for other programs, or cache. The same goes for code that implements functionality that is rarely (if ever) used. Why load it, if it never gets referenced?
 
In a regular program, there are lots of pages that are referenced once, or not at all.

Winner (2, Informative)

Anonymous Coward | more than 5 years ago | (#25995373)

Each process has it's own addressspace. This is necessary and usefull for several reasons.
1) You can get memory at any virtual address you request. This is necessary as .exe files usually contain no relocation section and thus need to be mounter always at the same virtual address.
2) Processes are well seperated, and on a 64Bit system each 32bit process can get a memoryspace which is addressable with a 32bit pointer, but the whole system having more memory than thet.
3) executable code (mainly .dlls) can be mapped as copy-on-write using the physical RAM only once, even if they are mounted in several process. Once a process modifies the executable it gets its own copy of the modified page, and the virtual address does not change.
And if you are talking about paged memory, it is still usefull even if you still have enough RAM, as you can reserve memory for future use. To be able to satisfy a commit of that memory at a later time the OS reserves that space in the swap file. As there is no data to write to the HDD you get no performance hit.

Finally! A use for my CS degree! (3, Funny)

sdaemon (25357) | more than 5 years ago | (#25995401)

I can finally put my CS degree to good use, answering the same questions students would ask the TAs in basic OS and systems-level programming courses! ...except that the other comments have already answered the question. So, in true CS fashion, I will be lazy and refrain from duplicating effort ;)

Laziness is a virtue! (And that's on-topic, because a lazy paging algorithm is a good paging algorithm).

Switch from Windows (1)

exabrial (818005) | more than 5 years ago | (#25995403)

Free Memory is wasted Memory. Even-More-Modern operating systems like Linux and BSD manage memory incredibly efficiently.

Swap is expected, so without it, you crash. (4, Informative)

Khopesh (112447) | more than 5 years ago | (#25995413)

I recall back in 2002 or so, a friend of mine maxed out his Windows XP system with 2gb of memory. Windows absolutely refused to turn off paging (swap), forcing him to whatever the minimum size was. The solution? He created a RAMdisk and put the paging file there.

On Linux (and other modern systems, perhaps now including Windows), you can turn off swap. However, the Linux kernel's memory management isn't so great at the situation you hit when you need more memory than you have, but you can't swap. Usually, the memory hog crashes as a result (thankfully, Firefox now has session restore). I might be slightly out of date on this one.

A well-tweaked system still has swap (in nontrivial amounts), but rarely uses it. Trust me, you can afford losing the few gigabytes from your filesystem. Again in Linux, /proc/sys/vm/swappiness [kerneltrap.org] can be tweaked to a percentage reflecting how likely the system is to swap memory. Just lower it. (Though note the cons to this presented at the kerneltrap article above.) My workstation currently has an uptime of 14 days, a swappiness of 60, and 42/1427 megs of swap in use as opposed to the 1932/2026 megs of physical memory in use at the moment.

This is summarized for Windows and Linux on Paging [wikipedia.org] at Wikipedia.

Good Advice (3, Interesting)

dark_requiem (806308) | more than 5 years ago | (#25995489)

Okay, so we've got most of the "you can run Vista with 4GB?!" jokes out of the way (hopefully). Here's my take on the situation.

I have Vista x64 running in a machine with 8GB physical memory, and no page file. I can do this because I'm never running enough memory-hungry processes that I will exceed 8GB allocated memory. So, while the OS may be good at deciding what gets swapped to the hard disk, in my case, there's simply no need, as everything I'm running can be contained entirely within physical memory (and for the curious, I've been running like this for a year and a half, haven't run out of memory yet).

However, if you don't have enough physical memory to store all the processes you might be running at once, then at some point the OS will need to swap to the hard drive, or it will simply run out of memory. I'm honestly not sure exactly how Vista handles things when it runs out of memory (never been a problem, never looked into it), but it wouldn't be good (probably BSoD, crash crash crash). I can tell you from personal experience that I regularly exceed 4GB memory usage (transcoding a DVD while playing a BluRay movie while ...). With your configuration, that's when you'd start to crash.

Long story short, with just 4GB, I would leave the swap file as is. Really, you should only disable the swap file if you know based on careful observation that your memory usage never exceeds the size of your installed physical memory. If you're comfortable with the risks involved, and you know your system and usage habits well, then go for it. Otherwise, leave it be.

Also don't forget to... (1)

DigitalisAkujin (846133) | more than 5 years ago | (#25995497)

split the page file in windows across multiple hard disks to create a fake RAID effect. And if one of those drives is a RAID array then all the better ;)

The shortest answer to the question is (0)

Anonymous Coward | more than 5 years ago | (#25995503)

IBM: Z/OS Z/VM

Cordially,
Kilgore Trout

Virtual memory != Swapping (1)

mileshigh (963980) | more than 5 years ago | (#25995513)

Swapping is a separate issue. You can virtualize memory with or without a swap file. Why? For starters, memory mapping gets rid of the entire problem of memory fragmentation at the system level. The list goes on from there, but eliminating fragmentation is huge. Anyone who's ever written or used a non-mapped OS will tell you in no uncertain terms why they suck!

just recalling how this works (3, Informative)

fermion (181285) | more than 5 years ago | (#25995561)

In college we ran the ATT Unix PC for a year or so. Apple also used this memory scheme. IIRC, the physical memory is first used for the kernel and system processes. How every much these processes take, that memory becomes more or less unavailable for the user. In your case, since you have 4GB physical, and 2GB used, this may mean that Vista is using 2GB for the system, if all memory is used.

What is left over is the physical memory needed by the system. It seems like the OS preferred a fixed amount of memory, so it would just set up fixed space on the hard disk. So, even if all you have a 1 MB of available memory, the system would set up say 10MB, and that is what would be used. The pages that are being used will be stored in the physical ram, while everything would be stored on the HD.

If page management is working correctly, this should be transparent to the user. The management software or hardware will predict what pages were needed, and transfer those page to ram. One issue we I had was available memory was not hard disk plus physical available ram, but was limited by the available hard disk space.

So, it seems to me that virtual paged memory is still useful because with multiple applications loaded, memory can be a mess, and big fast hard drives it should not be an issue. I don't how Vista works, but it seems that *nix works very hard to insure that the pages that are needed are loaded to physical memory, and page faults do not occur. In this case, where virtual memory equals available physical memory, it would seem that since only physical memory is being used, there would be no performance hit from virtual memory. it is only there in case an application is run that need more memory. It is nice that we do not get those pesky memory errors we got in the very old days.

Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...