Sunday, October 12, 2008   
  Search   
 
Register  Login  
Forums  
     Minimize  

Welcome to MeraWindows forums.

Thank you for being at the Microsoft Windows Community Site. You may have to register before posting in forums. It's absolutely free. After registering, you can get all the benefits available to our registered members, you can access our Downloads section, you can participate in contests, etc. You can post in forums in English as well as in Hindi, in fact we encourage you to use Hindi in your posts. If you have any problem with registration or login, please contact us.

     
  


 
  Microsoft Windows Forums  Windows Vista  Hardware  Why Does Vista Use All Memory?
Previous Previous
 
Next Next
New Post 8/17/2007 10:42 AM
User is offline Parul
356 posts
Advanced Member


Why Does Vista Use All Memory? 

Windows Vista has a radically different approach to memory management. Check out the "Physical Memory, Free" column in my Task Manager:

Task Manager Performance Tab in Windows Vista

At the time this screenshot was taken, this machine had a few instances of IE7 running, plus one remote desktop. I'm hardly doing anything at all, yet I only have 6 megabytes of free physical memory.

Now compare with this screenshot of Windows XP's Task Manager under similar low-load conditions:

Task Manager Performance tab in Windows XP

Under "Physical Memory, Available" I have approximately 1.5 gigabytes of free physical memory, as you'd expect.

So what's going on here? Why is Vista using so much memory when I'm doing so very little?

To answer that question, you have to consider what your computer's physical memory (RAM) is for. Just as a hypothetical, let's say you wanted to create a new text file:

 

  1. You double-click on the notepad icon.
  2. The Notepad executable loads from disk into memory.
  3. Notepad executes.
  4. Notepad allocates free memory to store your text document.

So Notepad clearly needs a little memory for itself: enough to execute, and to store the contents of the text document it's displaying. But that's maybe a couple megabytes, at most. If even that. What about the other 2,046 megabytes of system memory?

You have to stop thinking of system memory as a resource and start thinking of it as a a cache. Just like the level 1 and level 2 cache on your CPU, system memory is yet another type of high-speed cache that sits between your computer and the disk drive.

And the most important rule of cache design is that empty cache memory is wasted cache memory. Empty cache isn't doing you any good. It's expensive, high-speed memory sucking down power for zero benefit. The primary mission in the life of every cache is to populate itself as quickly as possible with the data that's most likely to be needed-- and to consistently deliver a high "hit rate" of needed data retrieved from the cache. Otherwise you're going straight to the hard drive, mister, and if you have to ask how much going to the hard drive will cost you in performance, you can't afford it.

Diomidis Spinellis published an excellent breakdown of the cache performance ratios in a typical PC circa January 2006:

  Nominal Worst case Sustained   Productivity
Component size latency throughput $1 buys (Bytes read / s / $)
      (MB/s)   Worst case Best case
L1 D cache 64 KB 1.4ns 19022 10.7 KB 7.91·1012 2.19·1014
L2 cache 512 KB 9.7ns 5519 12.8 KB 1.35·1012 7.61·1013
DDR RAM 256 MB 28.5ns 2541 9.48 MB 3.48·1014 2.65·1016
Hard drive 250 GB 25.6ms 67 2.91 GB 1.22·1011 2.17·1017

In summary, here's how much faster each cache memory type in your computer is than the hard drive:

System memory 37x faster
CPU Level 2 cache 82x faster
CPU Level 1 cache 283x faster

Those figures explain why I only have 6 megabytes of "free" memory in Windows Vista. Vista is trying its darndest to pre-emptively populate every byte of system memory with what it thinks I might need next. It's running a low-priority background task that harvests previously accessed data from the disk and plops it into unused system memory. They even have a fancy marketing name for it-- SuperFetch:

 

In previous versions of Windows, system responsiveness could be uneven. You may have experienced sluggish behavior after booting your machine, after performing a fast user switch, or even after lunch. Although too many carbohydrates might slow you down after lunch, your computer slows down for different reasons. When you're not actively using your computer, background tasks— including automatic backup and antivirus software scans— take this opportunity to run when they will least disturb you. These background tasks can take space in system memory that your applications were using. After you start to use your PC again, it can take some time to reload your data into memory, slowing down performance.

SuperFetch understands which applications you use most, and preloads these applications into memory, so your system is more responsive. SuperFetch uses an intelligent prioritization scheme that understands which applications you use most often, and can even differentiate which applications you are likely to use at different times (for example, on the weekend versus during the week), so that your computer is ready to do what you want it to do. Windows Vista can also prioritize your applications over background tasks, so that when you return to your machine after leaving it idle, it's still responsive.

This isn't a new concept, of course. But Vista treats system memory like a cache much more aggressively and effectively than any other version of Windows. As alluded to in the above lunch anecdote-- and as you can see from the Task Manager screenshot above-- Windows XP has no qualms whatsoever about leaving upwards of a gigabyte of system memory empty. From a caching perspective, this is unfathomable. Vista tries its damndest to fill that empty system memory cache as soon as it can.

Although I am a total believer in the system-memory-as-cache religion, SuperFetch can still have some undesirable side effects. I first noticed that something was up when I fired up Battlefield 2 under Vista and joined a multiplayer game. Battlefield 2 is something of a memory hog; the game regularly uses a gigabyte of memory on large 64-player multiplayer maps. During the first few minutes of gameplay, I noticed that the system was a little sluggish, and the drive was running constantly. This was very unusual and totally unlike the behavior under Windows XP. Once the map is loaded and you join the game, the entire game is in memory. What could possibly be loading from disk at that point? Well, SuperFetch saw a ton of memory freed to make room for the game, and dutifully went about filling the leftover free memory on a low-priority background disk thread. Normally, this would be no big deal, but even a low-priority background disk thread is pretty noticeable when you're playing a twitch shooter online with 63 other people at a resolution of 1600x1200.

I'm perfectly fine letting SuperFetch have its way with my system memory. The question shouldn't be "Why does Vista use all my memory?", but "Why the heck did previous versions of Windows use my memory so ineffectively?" I don't know. Maybe the rules were different before 2 gigabytes was a mainstream memory configuration.

The less free memory I have, the better; every byte of memory should be actively working on my behalf at all times. However, I do wish there was a way to tell SuperFetch to ixnay on the oadinglay when I'm gaming.

source- /vistarewired.com

 
New Post 8/17/2007 11:30 AM
User is offline Piyush Gupta
1834 posts
www.piyushworld.com
MW Addict


Re: Why Does Vista Use All Memory? 

Now the answer can only be given by MS people

 

Does Vista is a resource hungry system of previous windows was using memory so badly


Read Forum Guidelines before posting

 
New Post 9/30/2007 7:08 PM
User is offline Tanmay©
110 posts
www.microsoftdaily.com
Senior Member




Re: Why Does Vista Use All Memory? 

Well this is kinda of a good feature provided by Vista ! Excepting what the user will do next IMO is the way all future OS's are gonna work And as for Memory Hungry applications like Games, I think Vista will automatucally free up that used memory and allot it to the Foreground Task i.e. Gaming :)

No wonder Vista is way faster than XP. It's memory utilization feature is pretty neat !




 
New Post 9/30/2007 7:25 PM
User is offline Srinath Sadda
1230 posts
www.meraTechExplorer.com
MW Addict




Re: Why Does Vista Use All Memory? 
Modified By Srinath Sadda  on 10/1/2007 12:22:06 AM)
You need to read "Windows Internals, Fourth Edition". Task Manager in XP is a big fat liar. Windows Vista's Task Manager is not comparable.

The figure quoted as 'available' in XP is the sum of zero, free, standby and modified lists. The 'system cache' figure is the sum of the system cache working set (amount of physical memory used by the file system cache plus the physical memory used by pageable code and data in drivers, plus the kernel's paged pool) and the standby and modified lists. Your screenshot shows the double-counting: Available + System Cache is 1.5 times physical memory!

 

When a page is taken out of (trimmed from) a working set, it isn't immediately reused. Instead it is put on either the modified (if modified since last written to the page file or memory-mapped file it belongs to) or standby list. Links are kept from the process to the page. If the process then references the page again before it's paged out, it causes a page fault to occur but Windows can satisfy it simply by fixing up the page table entry - this is termed a 'soft fault'.

 

So how do pages get onto the other lists? Modified pages become standby pages by being written out to disk - a couple of background threads do this, mapped file pages are written after a maximum of five minutes on the list, and all pages start to be written after the modified list reaches 800 pages (about 3MB). Standby pages become free pages as the balance set manager (a thread that wakes up every second) runs, if the free list is too small. Finally, free pages become zero pages as the system zero page thread (runs at priority 0 and therefore only runs when at least one processor is idle) writes zeros to free pages.

 

When allocating physical memory Windows prefers zero pages for private user-mode page allocations, and free pages for kernel mode or mapped-file page allocations. (The use of zero pages is a security requirement to prevent processes being able to read other processes' data). If the zero page list is exhausted, Windows will use the free list and zero the page on demand; if the free list is exhausted for a free page allocation, it will then use the zero page list. If both lists are exhausted it will then try the standby list - it then needs to unlink the page from its original process at this point - and in the pathological case that that is empty, it has to take a modified page, write it out, unlink it, zero it, and then give it to a process.

 

This is why these lists exist - Windows has done work when idle to ensure that there is physical memory available on demand.

 

Speaking of on-demand: when VirtualAlloc is called to allocate memory, no physical memory is actually allocated. The 'commit charge' is simply incremented. It reserves space in the page file to make sure it can't overcommit on memory, but this reservation is a logical one - nothing is written to the page file. Only when a page is touched, and a page fault ensues, does a physical memory page get allocated (and the data loaded from disk if touching a memory-mapped file).

 

This commit charge is the value actually shown on the 'PF Usage' meter in XP's Task Manager, and in 'Commit Charge' total. 'Limit' is the sum of all page files plus physical memory minus whatever Windows can't page out.

 

There's no limit to how large the standby list can grow. The file system cache has a limit on its virtual address size of approx 300MB IIRC, but since this is implemented as a working set, pages discarded from the cache go on the standby or modified list! However, if files are opened as sequential scan, they go on the front of those lists, not the end, so are likely to be reused more quickly.

 

While on the subject of Task Manager, the Process tab's 'Mem Usage' column is actually the process's working set. However, this includes a lot of shared pages from system DLLs, so the sum of 'Mem Usage' normally is significantly larger than physical memory. It's impossible to tell if your program has a memory leak from this column. Switch on the 'VM Size' column (actually process private bytes) to monitor this, although this won't necessarily drop when you free from a heap.

 

So XP normally has a lot of moderately-recently-referenced data sitting in memory (but not recently enough to keep it in the working set) - well, once the system has been running for a while. The difference is that Vista is actively preloading data that it thinks you might use soon.

[ View ] considered Tanmav sujjection...


 
New Post 9/30/2007 9:46 PM
User is offline Vishal Gupta
6182 posts
www.AskVG.com
Ultimate Member








Re: Why Does Vista Use All Memory? 

^^ Excellent.


Microsoft Windows MVP

Tweaking with Vishal

How to Use Smiley Code in Forum?
Promote MeraWindows at Your Blog / Site
Read Forum Guidelines
 
Previous Previous
 
Next Next
  Microsoft Windows Forums  Windows Vista  Hardware  Why Does Vista Use All Memory?
   Get Your Own E-Mail Account @MeraWindows.com Minimize  
New Page 1 New Page 1
Show your cool quotient with @merawindows.com email account