Detecting Memory Bottlenecks

Memory shortage leads to poor performance faster than any other single resource shortage. Why? Memory shortages can cause the computer to have to read and write from the disk more often, and accessing the disk is much slower than just executing instructions in the processor.

We briefly mentioned in Chapter 2 that Windows NT is a virtual-memory system and uses paging so when it executes a program it doesn't have to store the entire program in memory at one time. Instead, only part of the program, divided into chunks of memory called pages, is in memory at any one instant. When the program instructions call for a page of code or data that is not currently in memory, Windows NT must bring in that page from somewhere, usually a disk. It is possible that a single instruction execution can cause one, two, or more page I/O operations.

The average instruction in today's computers takes something in the order of a hundred nanoseconds to execute. (A nanosecond is one-billionth of a second.) We saw in Chapter 4 that disk accesses range in orders around tens of milliseconds. Even one missing page per instruction would make the machine run 100,000 times slower than normal. Now that would be the mother of all bottlenecks!

Things do not usually get that bad. But they can get very bad, and when they do you need to know what you can do about it. (Besides find another job; our boss calls this Option 7, because if we haven't solved a problem in six tries, we're told that Option 7 is no longer optional.)