LinuxThreads replacement

Terry Lambert tlambert2 at mindspring.com
Thu Jul 10 03:22:26 PDT 2003


Mike Makonnen wrote:
> On Wed, Jul 09, 2003 at 10:11:15PM +0300, Petri Helenius wrote:
> > >for example, for on database instance, there are about 80 (lthread)
> > >processes hanging around.
> >
> > I would say with 80 threads you?ll get better performance with libkse
> > since you?ll get less contention on the process scheduler.
> 
> It's not as simple as that. In practice a lot of factors about
> your system and the type of work you're doing will affect the
> performance. On paper, the SA/KSE method is supposed to combine
> the best aspects of 1:1 (libthr) and N:1 (libc_r), and should
> threoretically be "better" than either one. But, in practice,
> complexity and overhead may drown out the performance gains.
> Conversely, context switching overhead may not be as great a
> penalty for the 1:1 model on modern cpus.

The most intersting issue is that the pthread_setconcurrency()
controls how many blocking contexts (KSEGs) you have available.
If process space is at a premium, you can scale to a much larger
number with KSE than you would be able to with Linux threads,
since with KSE, the threads are really rather light-weight user
space things.

You made a statement before that you had 80 threads, and with
Linux threads, you were feeling it at 80.  I wasn't sure from
the context whether you meant 80 was to many for your system or
80 was too few for your application, so I didn't say anything
before.  But this could definitely be a big factor in your
choice of threading library, given your previous statement.

-- Terry


More information about the freebsd-threads mailing list