Search This Blog

Tuesday, 26 April 2011

Hidden Treasure of Memory Mangement in Windows OS

Windows Operating Systems (OS) allocate Random Access Memory (RAM) for running processes. This physical RAM allocated to the process is called the Working Set. Access to data in the Working Set is extremely fast. If a process requires more memory than is allocated by the operating system, it can use the hard disk as Virtual Memory. In order to use the data in Virtual Memory, the OS must transfer the data from disk to RAM. This process is called Paging. Access to data in the Working Set is extremely fast. Access to data in Virtual Memory is relatively slow, because the disk operates slower than RAM and because Paging takes time.

When an application minimizes its top-level window, the OS reduces the Working Set for the application. This is done to free RAM for foreground processes. The performance of the minimized process may be affected if it must access Virtual Memory more often. You can read about how this is implemented in Microsoft KnowledgeBase 293215: The working set of an application is trimmed when its top-level window is minimized.

This is expected behavior of the Windows OS. You will notice the same behavior in other Windows applications such as Microsoft Word or the Calculator application. After maximizing the same application, you will see that the memory allocated to the application does not return to it's original value. This is again due to Windows allocating more than enough memory when starting the application but upon return to the maximized running window after being minimized it will have a better idea of how much memory is needed to run. If this behavior is a problem for some reason, the Microsoft KB explains how to prevent the Working Set from being trimmed when the window is minimized. You may also adjust this behavior by changing the Processor Scheduling option from Programs to Background Services in Control Panel»System»Advanced»Performance»Advanced»Processor Scheduling.

No comments:

Post a Comment