CPU Priority & Stacks

Even today's high-speed, super duper processors can still only manage to do one thing at a time. So what about this wonderful "multi-tasking" capabilities that we keep hearing about? How is it that we can surf the net while listening to the Mp3 files we stole...er, uh...shared?

This is accomplished through what's called virtual machines. Basically, since a computer can only really do one thing at once we fool the computer into thinking that it's actually several different computers. So each virtual machine is run almost as if it were a single complete computer. Each virtual machine gets it's own chunk of memory to use, and each gets a turn at some processor power.

To simplify this, imagine those old deep sea divers with the big, round steel helmets. Remember how they had this air hose which connected them to the boat, and the boat would pump air down to them. Now think of the diver as a virtual machine and the boat as the processor. The air hose represents what is called a thread. Each virtual machine connects to the processor with one or more threads, which serves as it's data pipeline.

Now imagine there's five divers underwater, but the pump on the boat can only hook up one air hose at a time. So the people on the boat hook up each diver to the pump, allowing them a couple seconds of air, then hook up the next diver, and the next one. Each diver gets a turn at a few seconds of fresh air. This is what the processor does, only it does it thousands of times a second.

There are essentially three types of virtual machines present on Windows 95/98/ME. DOS machines, 16-bit machines, and 32-bit machines. Since the old DOS programs were made to run on computers that really could only do one thing at a time (and not even all that well), the DOS programs run on Windows each get their own virtual machine and their own thread. Newer 32-bit programs also each get their own virtual machine and thread, but the old 16-bit programs designed for Windows 3.1 don't. All these programs and processes have to share basically one virtual machine and one thread.

To see this in action, open up Windows Explorer/My Computer and copy a large file or group of files from one folder to another. You'll see the little dialog pop up showing the files flying past. Notice how that window becomes essentially frozen. Now launch a second Explorer window and start browsing through folders. It may be a bit slower, but it's not completely frozen like the other. That's because this window has it's own pipeline to the processor, so the file copying taking place in the other has little effect on it. Now if it was a 16-bit program, the file copying going on in the one window would completely freeze the entire computer. Generally speaking, any time your entire computer locks up, it's due to some 16-bit program or driver.

There are two CacheMaster settings which pertain to this, CPU priority and stack pages. CPU priority is easy to understand. Going back to the divers, imagine that a king is down diving with one of his peasants. Don't ask me why a king would be diving with a peasant, just use your imagination. Clearly the fella in the boat would be more interested in making sure the king got a good supply of air than the mere peasant. After all, his head could be on the line. So he might give the king ten seconds each turn, but only give the peasant three. This is similar to how priority works.

Each virtual machine is granted a certain amount of processor time, which naturally is the amount of time the processor spends on that task instead of others. When a particular task is given priority, it gets a bigger chunk of processor time than those that don't. CacheMaster lets you give processor priority to either the programs you're actively using, or to memory access, or to your AGP or PCI bus, where you'll find things like your video card and sound card.

So how do stacks come in to this? Stacks are basically places where data waits in line for it's turn with the processor. The stack consists of a little 4 kilobyte chunk of memory in what is called a page. Sometimes programs can shove more stuff into the stack than it can handle, and the result is a stack overflow error. To correct this, you can increase the number of spare stack pages to help absorb any of these overflows. By default Windows keeps two spare pages, but if you're constantly seeing stack overflow errors you can increase the number of pages. Increasing the stack won't give you any real performance boost, but rather can help correct the errors caused by badly functioning software. Besides, all the performance in the world doesn't do you any good if your computer constantly crashes!

View Online Help

Back To Contents