From: Raven8712 on
Does anyone have any thoughts on whether dual processors are worth
building into a home computer or not?


- Raven

----> For a fun time, check this out>
http://ZeldereX.com/?topic=80844

From: Randy on
Raven8712 wrote:
> Does anyone have any thoughts on whether dual processors are worth
> building into a home computer or not?
>
>
> - Raven

Yes. No.

Randy
From: Skybuck Flying on

"Raven8712" <raven8712(a)yahoo.com> wrote in message
news:1125684201.841810.126440(a)g43g2000cwa.googlegroups.com...
> Does anyone have any thoughts on whether dual processors are worth
> building into a home computer or not?

Dual core is pretty expensive at the moment.

If you want a cheap computer the answer (at this point in time) is no.

If you want an interesting, high responsive computer and have money to burn
the answer is yes =D

An interesting question is the following question:

Suppose there are two processors one single core and one dual core. Both are
rated at the same speed for example:

Single Core Processor 5000+
Dual Core Processor 5000+

The question is how the rating is done.

The disadventage of a single core processor is that the software/operating
system/applications will have to do many "context switches". Only one
thread/process can run on a single core processor at a time, so multiple
concurrent threads/processess will have to be swapped on and off the
processor as to create the illusion of parallel processing. This switching
is called a "context switch" and can be considered "overhead" <- which is
loss of performance/speed.

Software/operating systems/applications which use many threads will cause
lot's of overhead on a single core processor.

Here is an example:

Two threads need to run concurrently/parallel. The software/operating system
will use context switches to create the illusion of concurrency/parallelism.

For example let's look at 10 time slices. In principle it will work
something like this:

Single Core Processor:

Thread1, Time slice1,
Contex Switch1
Thread2, Time slice1,
Contex Switch2
Thread1, Time slice2,
Contex Switch3
Thread2, Time slice2,
Contex Switch4
Thread1, Time slice3,
Contex Switch5
Thread2, Time slice3,
Contex Switch6
Thread1, Time slice4,
Contex Switch7
Thread2, Time slice4,
Contex Switch8
Thread1, Time slice5,
Contex Switch9
Thread2, Time slice5,
Contex Switch10
Thread1, Time slice6,
Contex Switch11
Thread2, Time slice6,
Contex Switch12
Thread1, Time slice7,
Contex Switch13
Thread2, Time slice7,
Contex Switch14
Thread1, Time slice8,
Contex Switch15
Thread2, Time slice8,
Contex Switch16
Thread1, Time slice9,
Contex Switch17
Thread2, Time slice9,
Contex Switch18
Thread1, Time slice10,
Contex Switch19
Thread2, Time slice10,

So as you can see from this example there are 19 context switches needed.
(Which is quite a lot of overhead at least that's what I think as a
programmer ;) and this is only for two threads !)

Now compare the above example to the dual core example which in principle
could work like this:

Thread 1 is dedicated to processor/core 1
Thread 2 is dedicated to processor/core 2

Thread1, Time slice1, Thread2, Time slice1,
Thread1, Time slice2, Thread2, Time slice2,
Thread1, Time slice3, Thread2, Time slice3,
Thread1, Time slice4, Thread2, Time slice4,
Thread1, Time slice5, Thread2, Time slice5,
Thread1, Time slice6, Thread2, Time slice6,
Thread1, Time slice7, Thread2, Time slice7,
Thread1, Time slice8, Thread2, Time slice8,
Thread1, Time slice9, Thread2, Time slice9,
Thread1, Time slice10, Thread2, Time slice10,

In principle no contex switches would be needed which would be a HUGE
adventage for performance.

(Assuming that both threads run at full speed and do a full workload etc.)

Dedicating threads to processors might make the prediction logic of the
processor work also much better. Though I am not completely sure about
that... maybe the processor has some tricks to store the prediction
logic/data in a cache when it detects a context switch or something... and
is able to load other prediction logic related to another thread somehow
etc... I dont know if processor can do this ;)

Ofcourse this could be an overly simplied look on how it works. The
dual/multi core processor has to share a single source of memory and a
single bus etc (?) So those might cause problems like concurrency problems
(?) or bottlenecks (?)

So the more cores a processor has the less contex switches are needed in
case the threads are all dedicated to a certain processor/core which would
be really cool/good =D

So for me as a (delphi) programmer and probably all other (delphi)
programmers multi core is definetly interesting. Especially since the delphi
language/development environment/libraries allow easy programming and
debugging of multi threaded applications =D <- child's play really =D

For me personally the multi threaded challenge is not programming the stuff,
the challenging is designing the stuff. It creates a whole range of other
(common) problems. For example thread1 might be receiving data from a
network, thread 2 might be processing the data from thread1, thread 3 might
be sending replies from thread 2.

Thread 3 might not be able to keep up with thread2. Thread 2 might not be
able to keep up with Thread1, etc. I think this is what is commonly known as
a "producer/consumer" problem etc ;)

Analyzing this design shows an immediate obvious flaw. The threads are
depending on each others outcome and are therefore bottlenecked etc.

A common different design is to have a "pool" of threads which all do the
same work but do it simply in parallel. For example:

Thread1 receives data, processes data, sends data.
Thread2 receives data, processes data, sends data.
Thread3 receives data, processes data, sends data.

This design would probably create a sort of pipeline. The network card can
only receive one packet at a time usually. Though this design would probably
still be faster than a single thread.

It would probably go something like this at least in principle:

Thread1 receives data.
Thread2 waits for data.
Thread3 waits for data.

Thread1 processess data
Thread2 receives data
Thread3 waits for data.

Thread1 sends data
Thread2 processes data
Thread3 receives data.

Etc:

Thread1 receives data.
Thread2 sends data.
Thread3 processes data.

Thread1 processes data
Thread2 receives data
Thread3 sends data.

Thread1 sends data
Thread2 processess data
Thread3 receives data.

Etc, etc, etc ;)

So a multi core processor might be able to utilize the network card better
simply because it's more responsive. It can immediatly receive a network
packet at least at the start and probably also later on.

The single core processor or single threaded software might not be fast
enough to receive,process and send the data and then be ready for the next
receive of data. "Blocking software" (which waits for a certain action to
complete could increase this problem) (I like to think waiting is bad ;))

Though this is a pretty simple example and therefore I wonder if this
example would make any significant performance difference in reality ;)

However the first example still stands ;) so for me as a programmer there is
no doubt. A well written software
program/application could run faster on a dual/multi core processor simply
because it prevents "expensive" context switches =D (by dedicating each
thread to a core/processor)

Bye,
Skybuck.


From: Kelly Hall on
Raven8712 wrote:
> Does anyone have any thoughts on whether dual processors are worth
> building into a home computer or not?

It depends. A couple of years ago, my home PC was a dual Celeron 400
box (Abit BP6 mobo) running BeOS. The hardware was cheap, and the
price/performance was great. I've since replaced that box with a single
Pentium M CPU machine running WinXP.

I think there are still dual CPU mobos available, but I don't know if
they are cheap enough for home use - it's not clear to me if the
price/performance is worthwhile.

I would expect that the price of Mac dual G4 systems is getting
reasonable, but I haven't priced anything recently.

Kelly
From: robertwessel2@yahoo.com on

Skybuck Flying wrote:
> An interesting question is the following question:
>
> Suppose there are two processors one single core and one dual core. Both are
> rated at the same speed for example:
>
> Single Core Processor 5000+
> Dual Core Processor 5000+
>
> The question is how the rating is done.
>
> The disadventage of a single core processor is that the software/operating
> system/applications will have to do many "context switches". Only one
> thread/process can run on a single core processor at a time, so multiple
> concurrent threads/processess will have to be swapped on and off the
> processor as to create the illusion of parallel processing. This switching
> is called a "context switch" and can be considered "overhead" <- which is
> loss of performance/speed.
>
> Software/operating systems/applications which use many threads will cause
> lot's of overhead on a single core processor.
>
> Here is an example:

(much silliness snipped)

Except for a few special cases, nobody would want two 1x processors
instead of a single 2x processor. In short, the single faster
processor will run almost everything fast, the dual processor will run
fast only if there is consistently more than one thread ready to
execute, and at best will match the performance of the single
processor.

The number of context switches is not typically reduced in any
significant way by going to a dual (or multi-) CPU system. The vast
majority of context switches occur because a thread blocks or calls on
another thread or context for a service (really the same thing), and
those are *not* impacted by the number of CPUs in the system. Context
switches due to time slice expirations *can* be reduced by a multiple
CPU configuration, but only if the number of threads tends to be close
to the number of CPUs. If there are many runnable thread, and the time
slice interval does not change, even that can be slower on the dual
processor system, since slices will occur after only half the number of
instructions. In any event, time slice triggered context switches are
*very* rare. At best a few tens to a few hundred per second.

Now two processors of speed 1.5x instead of a single 2x CPU is a lot
more interesting.