Windows 8 will arrive with a new system aimed at managing the resources available on a machine for applications to take advantage of.
Metro apps built using the new Windows Runtime are being suspended when in the background, so as to consume fewer resources and improve battery life.
On top of that, Windows 8 will also manage memory allocated to these applications so as to make use of it more effectively than before, especially when it comes to suspended processes.
“Starting with the Windows 8 Consumer Preview, whenever Windows detects memory pressure on the system, it will repurpose nearly all the memory that suspended Metro style apps would otherwise hold onto,” group program manager Bill Karagounis on Microsoft’s Fundamentals team explains in a blog post.
He notes that Windows 8 is capable of reclaiming this memory without having to terminate an app.
In fact, Windows will try to regulate physical memory allocations for all applications, be they Metro or desktop apps, no matter the memory requests that specific application has made.
“Windows is careful to only allocate physical memory to an app when the app tries to touch it, even if the app had “allocated” it earlier. Windows will also page out or repurpose parts of memory from an app if the pages of memory haven’t been touched in a long time,” Bill Karagounis notes.
This approach is meant to ensure that the available amount of memory is not eaten up, especially since apps have the tendency to over-budget.
“When the system starts to run low on available memory, the OS will look in all processes for pages of physical memory that it can repurpose to satisfy other needs in the system, even by paging out memory when necessary,” Bill Karagounis explains.
When desktop applications are involved, Windows will work on keeping the most important of pages of memory in the app’s working set (physical memory given to a process at any point in time) so that it could run code at any time, even in the background.
“It’s a fine balance though: if too many pages of memory were to be removed from a desktop app, it could affect the app’s responsiveness due to additional disk I/O (as the app tries to touch memory that has been paged to disk under the covers),” Karagounis continues.
Metro apps, however, although have memory allocated to them even when in the background, are not touching it in suspension mode.
Thus, starting with Windows 8 Consumer Preview, the whole (private) working set of a suspended Metro style app can be written to disk, so that memory is freed up when the system needs it.
“This process is analogous to hibernating a specific app, and then resuming it when the user switches back to the app. We’re taking advantage of the suspend/resume mechanism of Metro style apps to empty or re-populate an app’s working set,” Karagounis details.
When switching back to a suspended app, the pages will be added into app’s process immediately when they are still in physical memory, or are being read from the disk in an optimized manner when they are no longer available.
One thing that should be noted though is the fact that Windows 8 will still close Metro apps when memory gets into the critical range, though the system will be able to run multiple apps before reaching this point.
0 comments:
Post a Comment