Tuesday, February 27, 2007

Windows Vista memory management

Sounds exciting, doesn't it? Well, it is. Last September Jeff at codinghorror.com published an interesting article comparing Vista's RAM caching (with SuperFetch) versus XP.

According to Jeff, Vista is much more aggressive, which will, theoretically, result in a less sluggish computer. This happens, essentially, because SuperFetch fills up most available RAM with things you're likely to need soon. It's also "smart", meaning it monitors your usage patterns and adapts accordingly. It may learn, for instance, when you go to lunch, and preload an anti-virus program just prior.

About five years ago I was on this bandwagon with some friends. I told them that one day every file and every application on the PC would load into RAM at power-on -- this would happen after ungodly amounts of RAM resided in our PCs. With plenty of new PCs shipping with 4GBs, we're getting close.

The devil is in the details, of course. Application developers always manage to take full advantage of every resource available, especially for games. Usually the only way to run a game with its full potential is to have a very powerful PC and give the game everything you have except whatever is needed to keep the OS from yawning.

Vista's SuperFetch isn't exactly what I had in mind, but it seems to be on the road.

How well does SuperFetch work, and more importantly, does Microsoft allow me to change its behavior? Gamers and anyone else using resource-intensive applications (video, engineering, etc.) will want all available resources. A commenter to Jeff's article sums it up nicely:

    This would be a tool I'd definitely want to play around with before enabling. Loss of game performance to keep grandma's cookie recipe in memory at all times doesn't seem like a very good trade-off to me.

The answer to controlling SuperFetch is: I dunno. It runs as a service (application sans GUI), so it can be disabled. All my PCs are XP, so I haven't had a chance to see SuperFetch in action. It seems that if you prefer an automatic transmission in your car, you'll like SuperFetch. If you like to control the car, rather than turn it over to a machine, an automatic SuperFetch isn't so nice.

The ultimate solution, as always, is to have one PC for gaming or other intensive apps, and one for everything else, like downloading porn 24/7 office apps and the web. These automated tools are designed for the masses, who don't use computers to their full potential -- and what's worse, most people actually prefer to remain ignorant of how a computer works (and their car and everything else around them). They hope the mysterious box with the blinking lights does what's required. An engineer once told me this is called FM, or Fucking Magic. Anything too complex to be understood runs on FM. (Damn! I tried so hard to conceal my disdain for humanity in this post. I really did try.)

A commenter on Jeff's article says there are problems with XP's Task Manager, which was used as the comparison tool between XP and Vista.

    Jeff, 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!

Jeff used a screencap of Task Manager under XP alongside one from Vista, on similar PCs under similar, low level loads. Is it just me, or are these the exact same images? I can't see any difference.

I looked around the internets for information about SuperFetch, and found a few interesting things:

+ ComputerWorld says it is one of 20 reasons Vista is the best thing since masturbation sliced bread.

+ Jim Allchin of the Vista development team had this to say:

    One of the key enhancements to the Windows Vista memory management system is a new feature called SuperFetch. I discussed this briefly in my blog post about ReadyBoost. SuperFetch watches how you work and then uses the RAM on your system in a new way that optimizes the system's performance to the way you work. For example, in contrast to traditional memory management systems that today use an approach to prioritizing how RAM is allocated to the various programs and services running on the system, SuperFetch can differentiate memory being used for interactive (high-priority) tasks from memory used for background (low-priority) tasks. When the user isn't interacting with the system, background tasks are allowed to run, but when they complete, SuperFetch repopulates RAM with the content that supports the interactive applications. SuperFetch is also smart enough to know which applications are used most often (over a long period of time) and pre-loads those applications into memory.

+ OwensPerformance compares SuperFetch to Mac OS X.

Speaking of memory management, my XP laptop with 512MB RAM is presently running seven instances of Firefox, Windows Media Player, and Photoshop. The little laptop that could...

No comments: