Muiti-core processors
Article Index
Muiti-core processors
Hyperthreading to the rescue
Multi-core

Multi-core programming

Hyperthreading is an attempt to keep the processor fed with instructions to give it something to do. If this is the case then the next step in the logic might seem a little strange.

Instead of having one physical processor and two logical processors why not double up on the number of physical processors? That is, build two processors on a single chip. Each one could also be hyperthreaded, making a total of four logical processors on a single chip. The arguments also apply to four physical cores on a chip. If each also supports two hyperthreads then physical quad-core processor has eight logical processors.

This is a particularly easy way to use twice as many transistors on a chip but is it a good way?

The heat problems are still present, despite some reductions but a new chip socket design and motherboard should help keep things cooler. Intel is claiming that two cores will be equivalent to a 40% speed boost and adding more cores will produce the same level of improvement.

This is possibly a misleading claim that depends on the simple idea that two horses are better than one. When it comes to pulling a load this might be true but it certainly isn’t when it comes to a horse race.

A dual-core processor will run a single thread at the same speed as a single-core processor. The only sense in which it is faster is if it can run two threads at the same time. This implies that the two threads are independent, i.e. they don’t interact with one another. In a server machine there are lots of independent threads corresponding to different users accessing different web pages, files, database records and so on. In this case multi-threaded processors speed things up as predicted and they are used in this way already.

The first thing to say is that multi-core processors have no problem with operating system support. Windows and Linux have both supported multi-processor architectures for some time - and as far as the OS is concerned a multi-core processor is nothing new. Indeed multi-processor architectures have been the norm in high performance servers for some time and in this situation they really do make a difference. The reason is that a server is generally trying to run a range of very different tasks and as such the throughput of the machine can be improved by allocating each task to a separate core.

On a desktop machine, however, the story is very different. If you use the Windows Task Manager to view Processes running on your machine you will find that in most cases the System Idle process is using 95% or so of the processor’s time. That is, the processor simply doesn’t have enough to do for most of the time. In this case adding a multi-threaded processor isn’t going to help as much. The perceived performance of a desktop machine depends mostly on being able to do one thing very quickly on demand in response to the user.

Of course, programmers can change individual programs to be multi-threaded and some already are built this way. For example, graphics programs like Corel Draw, use one thread to re-draw a graphic, another to interact with the user and so on. The .NET graphics and UI system WPF is inherently multi-threaded and hence most new applications should take advantage of multi-core. However this isn't easy as multi-core/multi-threaded programming isn't something programmers have been accustom to and it is yet another way of introducing subtle errors into a program. Put simply multi-threading programming is hard and it will take some time before the necessary tools are available and used to make a single application go faster on a multi-core machine.

 

fig4

A dual-core processor has two physical processors on the same chip able to run two threads at the same time

There is no doubt that multi-core processors are a good idea and they will make tasks such as video compression, CD burning, playing multimedia, and so on, more possible in the sense that they will no longer bring a desktop machine to a grinding halt – one core can deal with the user and the other the processing-intensive task. So perhaps the issue with dual-core processors isn’t speed but remaining responsive to the user.

In time our programing skills will expand to incorporate multi-threading in a safe and easy to use way - and whatever the future holds for hardware and programming you can be sure that it's parallel. 

 

<ASIN:3939084700>

<ASIN:0123814723>

<ASIN:364204817X>


Banner


The Computer - What's The Big Idea?

There can't be a more central concept than “the computer”, but it is such a commonplace that we tend to take it for granted and miss how truly amazing it is. It might just be that computers are ev [ ... ]



Finite State Machines

Finite state machines may sound like a very dry and boring topic but they reveal a lot about the power of different types of computing machine.  Every Turing machine includes a finite state machi [ ... ]


Other Articles




 
 

   
RSS feed of all content
I Programmer - full contents
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.