Ian C.Sison writes:

> On Fri, 07 Apr 2000, you wrote:
> > On Fri, 7 Apr 2000, Ian C.Sison wrote:
> > ..
> > > U-uh, I don't agree.  First of all threads on linux is a misnomer
> > > because it isn't supported by the kernel.  A kludge is done to make it
> > > seem to be a thread but it is actually a fork in disguise.
> > 
> > It's functionally a thread, and its good enough for MySQL which is one of
> > the most demanding threaded applications out there.
> > 
> > The reason threads are implemented as processes in Linux is to avoid extra
> > LWP overhead and to allow threads to be seamlessly distributed over
> > processors. 
> 
> There was an article i read once that mentioned the fact that distributing
> threaded code over several processors actually degrades performance rather than
> improves it.  

Not likely. There's a point of diminishing returns as the need for
serialization between threads or processes increases, though.

> Reason?  Context switching between threads and processors breaks
> the caches of the CPUs enough to provide a noticable performance hit.  So much
> so, that you'ld be better off with a uniprocessor box.

Your CPU does context switching all the time. In most applications,
performance is more likely to be constrained by your userland code than by
context switching.

> I'm not sure about this one, and neither do i have benchmark 
> results proving
> that the assertion i read was really true. \8)

You're probably referring to Amdahl's law. The increase in performance that
can be gained by parallelizing an application is limited by the fraction of
non-parallelizable code.

Mathematically, if p is the fraction of code that can be made parallel, and
n is the number of CPUs:

                    1
Speedup(n) = ----------------   (where p < 1.0)
              (p/n) + (1-p)

Refer to Butenhoff's book on POSIX threads. He explains it better than I
ever could.

Brian
--
Brian Baquiran <[EMAIL PROTECTED]>
http://www.baquiran.com/
AIM: bbaquiran

-
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to