Thursday, May 28, 2009

A Tapestry of Threads

In the early days computers could only execute one instruction after another, there was a single CPU and a single Thread of execution. Computers give the illusion of doing many things at once by a technique called Time-Sharing: the work is divided up into many Processes, and the Operating System runs each process for a few thousandths of a second, switching from one process to another. Several people could be using a computer at the same time, each working under the illusion that they had the computer all to themselves - except the more users and processes there were the slower the computer seems to get.

For a long time computers have gotten faster and faster, but at every moment in time computers were just as fast as they could go. The only way to make a more powerful computer was to tie two or more Central Processing Units (CPUs) together in one system. In most cases all CPUs shared the same memory, and the Operating System could take any process and run it on any CPU, making the whole system more powerful because now more than one process could be running at the same time. This was especially useful on systems with lots of users. These were the haydays of mainframe computers.

When personal computers became popular there was never a big need for more than one CPU because each person had the whole system to themselves. For a long time CPUs just got faster and faster every year and were able to do more work, keeping up with increasingly sophisticated and demanding software. About 5 years ago a terrible thing started happening, CPUs stopped getting fasters, primarly because we reached certain limits in the laws of physics. For at least 5 years the fastest CPUs are about 3 to 4 GHz and that's just not likely to change with current electronic computer circuits. The fastest a computer has run to date is just over 7 GHz, but that requires liquid helium and is very expensive and fragile.

But people still demand ever more powerful computers every year. They only way computer makers have been able to make systems more powerful is by adding more CPUs. Now the terminology gets a little crazy. In a single chip computer hardware people refer to the chip as the CPU. Chip makers actually put two or more CPUs on one chip, but they call them Cores. If a CPU has 4 cores the operating system views this as 4 separate CPUs, and software people call them logical CPUs. Some CPUs use a technique called Hyperthreading where each CPU or core is able to run two or more separate threads of execution at the same time. Hyperthreading is not as powerful as adding more cores, but it is an economical way to run more than one process at a time. So if you have a chip like Intel's Core i7 or Xeon 5500, Intel calls this a Hyperthreaded 4-core CPU - but to Windows this looks like 8 separate CPUs. In fact if you open Windows Task Manager you will see 8 CPUs.

Now the system I am building is a Dual Xeon 5580, to Intel that means two CPUs, 8 cores, and 16 threads. To Windows that means 16 CPUs.

No comments:

Post a Comment