Improve System Performance by Using Proper Working Set Size

Last reviewed: March 12, 1997
Article ID: Q126767
3.50 3.51 4.00 WINDOWS NT kbprg

The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5, 3.51, 4.0
    

SUMMARY

While increasing your working set size and locking pages in physical memory can reduce paging for your application, it can adversely affect the system performance. When making decisions for your application, it is important to consider the whole system, and then test your application under a heavily loaded system, such as the users of your application might have.

MORE INFORMATION

The Win32 SDK provides a tool called the working set tuner (WST.EXE). The working set tuner decreases the working set size, which decreases memory demand. However, you can also choose to set the process working set minimum and maximum using SetProcessWorkingSetSize() and/or lock pages into memory with VirtualLock(). These APIs should be used with care. Suppose you have a 16-megabyte system and you set your minimum to four megabytes. In effect, this takes away four megabytes from the system. Other applications may be unable to get their minimum working set. You or other applications may be unable to create processes or threads or perform other operations that require non-paged pool. This can have an extremely negative impact on the overall system.

Reducing memory consumption is always a beneficial goal. If you call SetProcessWorkingSetSize(0xffffffff, 0xffffffff), this tells the system that your working set can be released. This does not change the current sizing of the working set, it just allows the memory to be used by other applications. It is a good idea to do this when your application goes into a wait state. When you call SetProcessWorkingSet(0, 0), your working set is reset to the default values. In addition, if you call VirtualUnlock() on a range that was not locked, it is used as a hint that those pages can be removed from the working set.


KBCategory: kprg
KBSubcategory: BseMm
Additional reference words: 3.50 3.51 4.00
Keywords : BseMm
Version : 3.50 3.51 4.00
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.