Subject: Re: PostgreSQL
To: None <segv@netctl.net>
From: None <kpneal@pobox.com>
List: tech-perform
Date: 02/01/2006 22:24:04
On Thu, Feb 02, 2006 at 03:07:00AM +0000, segv@netctl.net wrote:
> Both of you, Neil and Thor, have asked me why I think that fine grained
> threaded applications will perform better. Here is why I think that:
> 
> http://www.sun.com/processors/UltraSPARC-T1/index.xml
> 
> Sun have released a new CPU, which is capable of running up to 32 concurrent
> threads. I think soon everyone will follow the same path. Multicore CPUs are
> becoming popular because increasing clock rate is becoming more difficult and
> it generates too much heat. Also UltraSparc-T1 is designed for multithreaded
> applications, i.e. it has hardware support built in for executing threads in
> parallel and to keep the processor pipelines busy.
> 
> To take advantage of such multicore CPUs, code needs to be decomposed into
> parallel regions, which can be executed in parallel. Threaded applications that
> have a fine grained design will benefit the most from such hardware. 

I'm willing to bet the people in this thread know all this stuff
already. 

What I haven't seen posted is documentation that says whether or not
the new Sun chips keep an Address Space ID with each thread. If they
do then the threads can be part of different processes and yet run
in the pipeline at the same time. 

Wasn't there some noise once apon a time about newer Alpha chips
using just such an ASID? I don't remember if that chip made it out
the door, though. 

> The most important thing is: the application needs to be designed for fine
> grained concurrency from the start. Forking new processes is one way to achieve
> concurrency, but it doesn't scale and many applications don't actually fork
> that many children. It's more the way they operate on data, i.e. sometimes data
> can be processed in parallel, e.g. parsing HTTP headers, HTML files, etc. I
> have a 4-CPU Sun machine, when using Firefox to browse webpages, only 1 CPU is
> busy 100%, the rest are sitting pretty much idle. Here is a good example where
> fine grained threading could improve performance by a large margin. Firefox
> creates a seperate thread for each tab/window, but that's not good enough (I
> can only browse one page at a time), it should use multiple threads when
> parsing and rendering web pages, etc.

How big are the web pages you are looking at? I'd bet that the overhead
in splitting work up between multiple threads just for a single page
is greater than the benefit.
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"What is mathematics? The age-old answer is, of course, that mathematics
 is what mathematicians do." - Donald Knuth