INFO: Improve System Performance by Using Proper Working Set Size

ID: Q126767


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT versions 3.5, 3.51, 4.0
    • Microsoft Windows 2000


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.

Additional query words: 3.50

Keywords : kbAPI kbKernBase kbMemory kbWinOS2000 kbDSupport kbGrpDSTools kbGrpKernBase
Version : winnt:3.5,3.51,4.0
Platform : winnt
Issue type : kbinfo


Last Reviewed: January 5, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.


Send feedback to MSDN.Look here for MSDN Online resources.