Thursday, August 16, 2007

Why Threads and Current Multicore CPUs Are Evil

Lately, Intel and other CPU manufacturers have been complaining that software vendors are not keeping up with the parallel processing advances inherent in multicore processors. What they are really saying is that software applications are not using as many concurrent threads as they should. Since multicore processors are designed to process multiple threads simultaneously in the on-chip cores, an application that uses few threads cannot take full advantage of the available processing power.

The problem with threads is that they are evil and they are evil for three reasons as follows:

  1. They are algorithmic.
  2. They are asynchronous.
  3. They require context switching.

Basing software construction on the algorithm is evil because it ignores the true nature of computing. It is the primary reason for the software reliability and productivity crisis. Asynchronous processing is evil because it leads to non-deterministic timing, which, in turn, leads to unreliable software. Context switching is evil because it introduces a lot of processing overhead. This becomes unmanageable in a system that uses fine-grained parallelism to handle a huge number of simple parallel objects. There is a simple way to perform synchronous parallel processing that does not require the use of threads. CPU designers should abandon the algorithmic/thread model and adopt the COSA Software Model. COSA is a non-algorithmic, signal-based, synchronous software model. It is simpler and it solves all the nasty problems that are currently plaguing the computer industry.

PS. I'm kidding about the 'evil' part but threads are bad, any way you look at them.

No comments: