We pull apart Windows 8 bit by bit to reveal what's under the hood of Microsoft's bold next step.
More than just a sequel to Windows 7, Microsoft is all but betting the bank on the mobile revolution that already sees consumers needing operating systems that span across desktop, laptop, tablet and phone. And Microsoft wants to be there for all of them.
To get there, Windows has undergone a metamorphosis, and the Windows 8 Developer Preview gives us an insight into the new Metro interface and a range of new features. But what about the underlying core? Is this going to be another bloatware release, or can we expect the best Windows yet?
Windows 8 loads components like Metro and Classic Desktop on demand to save memory.
One positive driver for Microsoft's goal of Windows everywhere is that Windows 8 needs to compete in the mobile space. Traditionally, Windows hasn't fared well on mobile platforms -- low-power computers like netbooks have had to use Windows XP because Vista and Windows 7 were too bulky. But this may be about to change. Memory is a constraining factor for mobile platforms, not only in terms of performance but also power use: RAM consumes power, and the more RAM a device such as a tablet needs to cater for an operating system, the less overall battery life will be. If Microsoft can make Windows 8 run efficiently with less memory, Windows 8-based devices will requires less onboard memory and in turn have longer battery life.
With the release of the Windows 8 Developer Preview, Microsoft demonstrated that not only does Windows 8 use less RAM than Windows 7 but that the OS can run ‘optimally’ with just 200MB. To prove the point, it showed the Task Manager memory usage stats from an Atom-based 1GB netbook under Windows 7 and Windows 8, which revealed a difference of around 30% in Windows 8's favour.
It's a bold claim, given the ever-expanding system requirements of Windows over the years, so we ran our own tests using clean installs of the Windows 8 Developer Preview and Windows 7 on a 2GB virtual machine and, after letting the machine idle for five minutes for both operating systems, saw something a little different: Windows 8 actually using a tad more RAM than Windows 7. To be fair, this is the Developer Preview and is not final and, it's worth noting, Windows 8 had Metro running in addition to the classic desktop, so it must be doing something right. We'll have to wait for the final release to really see.
So how is Redmond working to make Windows 8 a lean, mean, Microsoft machine? Windows 7 already has good memory management, but if Windows 8 is to be slimmer and trimmer, a few tricks will need to be employed.
Memory combining
Applications and system services sometimes call upon the same DLLs to do their job, and it makes little sense to duplicate the same data in multiple locations if, instead, programs can be pointed to the same copy of the data in memory. Additionally, applications often pre-emptively initialise more memory than they need, which when you have multiple programs going leads to unused memory going to waste. Windows 8 actively looks for duplicated memory contents and frees up them up, keeping a single copy which is then shared. If a program later needs to write to those shared pages, Windows 8 will give the program a private copy. According to Microsoft this can shave off hundreds of megabytes of memory use depending on how many applications are running -- and it all happens transparently.
Memory prioritisation
Windows needs to make decisions when memory is running short on what programs and parts of programs to keep in memory and what parts to swap out to disk. Traditionally, Windows does this based on which apps are currently being used more frequently, but it's not an ideal system. Using the example Microsoft gives, an antivirus program may periodically wake up to scan files, consuming memory. Once complete, as it was recently used, its memory may have a higher priority than, say, programs you’re actually using at the moment like your email or Office. It doesn't make sense to prioritise this memory over more useful programs to be swapped out, should memory fall under pressure. So Windows includes a new ability for programs to designate their memory use as 'low priority' such that, under memory pressure, Windows will actively swap out low priority memory first. In this case, once the antivirus scan is complete, its pages are dropped to the bottom of the heap ready to be swapped out if needed. We assume this requires co-operation with third-party developers to code their apps this way, but you can bet Microsoft will put pressure on companies like antivirus vendors to do this because, ultimately, the total memory usage of Windows 8 is a combination of the OS and the apps you run.
Hot and cold pages
This one isn't fully explained but in principle Microsoft has analysed the contents of memory pages in typical operation, specifically relating to core OS components, and determined those of that are 'hot' and frequently used, versus 'cold' which, while they might be necessary, are not frequently accessed. By rewriting core Windows components -- some dating back to the early days of NT -- and changing data structures to consolidate and separate 'hot' parts of memory from 'cold', the company claims it's reduced the overall runtime memory cost of Windows 8 itself by tens of megabytes. Again it may sound small on your average desktop, but on memory-constrained devices such as tablets, every little bit adds up.
Services
Windows 8 further reduces its memory footprint by dropping around 13 different services and moving others from Automatic into Manual startup or an entirely new service priority called 'Start on demand'. As it says on the tin, on-demand services will run when needed and then unload, freeing up resources. An obvious candidate for an on-demand service is Windows Update, but there are others Microsoft is designating and it will be possible for third-party vendors who install services with their programs to follow suit.
Incidentally, this is also one of the tweaks that helps Windows 8 achieve such blazingly fast boot times. Less services are loaded at boot time, while others are delayed or not loaded at all unless needed, allowing the user to be dropped to desktop quicker.
On-demand desktop
In the 'if you don't need it, don't load it' category, Windows 8 will only load desktop components as they’re needed. Specifically, if you're spending all your time in Metro, memory won't be wasted caching a copy of Explorer or the Classic Desktop wallpaper, for example. The moment you switch to the desktop these are loaded, and then unloaded again if you return to Metro (presumably after a short period to be efficient if you're switching back and forth). The amount of memory saved is presumably small and likely to be insignificant on a desktop, but again portable devices with less memory will benefit.