While shrinking an existing CPU
's component size or cooling it better allows you to increase its Clock Speed
, physics dictates
that computer chips can only get so small, unless you get exotic
. Adding more stages to the instruction pipeline allows for the processor to do more in less time, but excessive pipeline length makes nonlinear code
execute slowly. How can we continue to make processors faster now that all of our old tricks are starting to run into a brick wall, CPU makers asked themselves? Simple, pack more than one of these modern processor cores
in each chip.
The multi-core processor tries to integrate as many CPU cores and its components as possible in a given package size. Despite the fact that CPU cores can still only do one thing at a time (until we come up with something else), the benefits to this are twofold:
- The computer can handle as many processes as there are cores.
- A process can take all the cores for maximum throughput.
However, there are a few caveats:
- Performance only really improves with programs that have a lot of independent operations. For example, video editing has a lot of independent operations because the frames to be processed already exists so each core just grabs unprocessed frames as soon as it's done with the one it was working on. Many programs people use are I/O bound, which means they are waiting for some input or output device (like the hard drive, the network, or commands from the user) to do something. Video games may or may not see it, depending on what's going on. Overall, if the CPU is being used a lot, adding another core may help.
- The cores may fight for resources, especially data operations. Even though there's more cores, there's still only one memory controller they have to share, among other things.
- The operating system or program has to be aware of the cores and coordinate them. You do not want a CPU core to work on something another core is working on and you don't want them to stamp on each other's memory spaces.
- This was especially a problem with the Sega Saturn and part of the reason why developers hated it. Granted, Sega's Virtua Fighter Remix did provide a good example of how to use the system, but this was a new thing at the time. Many programmers stuck with the tried and true programming for one processor.
A common misconception is that multi-core processors are the same as a single core with a multiplied speed. A single core with multiplied speed will always handle instructions faster than a multi-core processor can, especially with processes that can't run on more than one core. For example, if Process A, B, and C had run time completion of 1, 2, and 3 seconds respectively, a quad-core processor will get this done in 3 seconds since each process goes to an available core. A single core processor of multiplied speed will get them done in (1 + 2 + 3)/4 or 1.5 seconds.
On an aside, there's a technique some processor manufacturers use called simultaneous multithreading. What this does is that it allows multiple instructions to be issued to available execution units in a core. Normally the OS sees this as another core or processor. While it carries the same benefits and caveats as before, it's not as efficient and it increases power consumption a bit.
The limitations of parallelizing code are spelled out by Amdahl's Law
on The Other Wiki