Tuning the Working Set of Your Application

Space: the final frontier. We're not quite sure whether we programmers get yelled at more because our programs are slow or because they take up too much space. We don't understand—hasn't the boss heard that memory is now cheap?

Apparently not. So in this chapter we'll discuss the Windows NT Working Set Tuner. It can help you reduce the amount of space your program takes in RAM. You should tune your application's working set even if you are perfectly happy with its speed. It's important to keep in mind that your program will probably have to coexist with other executing applications, so there's just no point in wasting space if you don't have to. The code in Windows NT itself has been tuned with the Working Set Tuner.

Even if you don't care about all the space you are taking away from other programs, you probably care about the time it takes to load your own program into RAM from disk. None of us is overjoyed about application load time. The Working Set Tuner can help with that too.

The Working Set Tuner can improve the speed of your program in another way you might not have thought of. We've discussed the processor caches, and in the last chapter we briefly mentioned the translation buffer, which is another processor cache used for page translation. Working set tuning can reduce the amount of space your program requires in both types of caches, in particular in the use of the translation buffer. Not only will your application code execute faster, it will interfere less with the code in Windows NT. To see why, we'll have to look under the covers and see how the Windows NT Working Set Tuner operates.

At the end of this chapter, we'll also describe how to use the vadump tool, which lets you look inside your application's working set.