Top tips: how to make Windows slicker and faster

Microsoft Windows
Tweaking the priority of a process can deliver a small performance boost, but be careful – it can cause problems, too

According to Microsoft, understanding how Windows works is no easy task. If you're a regular home user, they imply, there's no need to worry your pretty little head about such technicalities. Get back to playing games and browsing the web: leave the clever stuff to us.

Of course, this isn't entirely true. Sure, most people won't gain anything from studying the data structures that surround a Windows process, for example. However, learning just a few fundamentals can help you to improve your PC's performance, troubleshoot problems and diagnose – or prevent – system crashes. And you don't need a degree in computer science to understand these ideas, either.

Thread count

Press [CTRL]+[Shift]+[ESC] to launch Task Manager, click the Processes tab and you'll see a lengthy list of programs running on your system. Click 'Show processes from all users' (on Vista) and you'll add even more, a total of over 60 on our test PC. That's a busy setup, but the reality for your processor could be even worse.

The fact is that a Windows process doesn't 'run' anything at all. It's just a collection of data relating to a program. Every process contains at least one thread, though, and it's this that executes program code. Click 'View | Select Columns', find and check the Threads box, click 'OK' and you'll see that virtually all your processes have more than one thread. And many have considerably more: numbers of 10, 20 or 30 are by no means uncommon. Our test system had more than 600 threads listed, without opening a single application.

This doesn't mean all 600 threads want to run simultaneously, though, and Task Manager can reveal this, too. Click 'View | Select Columns', check 'CPU Time' and click 'OK': you'll see most processes have very little or no recorded CPU use at all. These are like Windows Services, set up and ready to run, but not actually consuming any CPU time until you need them for something.

Still, even if some threads are dormant, there will often be more running than your CPU can handle at once. So how does the system decide which thread gets the most attention?

Scheduling issues

Windows assigns every thread a 'quantum', which is a length of time that it's allowed to run before another thread may get a turn on your CPU. Consumer editions of Windows use a short quantum, perhaps 20 milliseconds, which means no task should be able to grab the processor for very long.

The system also triples the quantum of the foreground application, so its threads get 300 per cent more CPU time than the competition. That's a good way to ensure that whatever program you're working on stays snappy and responsive, but there's a price to pay.

Every time your CPU swaps threads it must also perform a context switch, where it saves the state of one thread and then recalls the state of the next. And this takes a short – but still measurable – amount of time. A short quantum makes for a responsive interface, then, but also increases the overhead for your CPU. It spends a lot of time just managing the system rather than getting on with running your threads.

As a result of this issue Microsoft Server products use a long quantum, six times longer than consumer Windows and so make far more efficient use of the CPU. Sounds useful? It's easy to try this for yourself. Open the System applet in Control Panel, click 'Advanced' (then 'Performance Settings | Advanced in Vista') and set 'Adjust for best performance of' to 'Background services'. Windows will now set your PC to use a long quantum with no foreground boost. This means reduced CPU overheads and better overall performance, especially on systems that run a lot of programs.