Improve System Performance by Using Proper Working Set Size

ID: Q126767

3.50 3.51 4.00 WINDOWS NT kbprg

The information in this article applies to:

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          : kbAPI kbKernBase kbGrpDSTools kbGrpKernBase 
Version           : 3.50 3.51 4.00
Platform          : NT WINDOWS

Last Reviewed: October 4, 1998