Subject: Re: native pthread support in 1.5
To: None <>
From: John Maier <>
List: netbsd-users
Date: 08/28/2000 16:27:03

Great to hear pthread support is be done the CORRECT way.

I personally follow the gnu-pth development fairly closely.  Over the years
it has been very interesting to read Engelschall's responses to Linux
user/programmer who try to port pthread apps from Linux to pth.  It seems
Linux does a few unorthodox things with their pthead that ends up breaking

A perfect example is LICQ (ICQ X clone) which uses ptheads.  The guys who
wrote it are developing on Linux.  I have actually got it to compile under
NetBSD using GNU-pth (sorry PTL2 is lacking some calls) and it comes up, but
the packet transaction stopped cold due to some Linux pthead specifics.

Give Engelschall's code isn't perfect (he's constantly releasing new
version) but he really tries to remain true to the POSIX/ANSI-C specs and
seems to really know what he's talking about.

I agree that using Solaris as a model is a good way to go.  It really does
work well and seems to be very stable.

John Maier
Midamerica Internet Services

----- Original Message -----
From: "Jason R Thorpe" <>
To: "John Maier" <>
Cc: <>; <>
Sent: Monday, August 28, 2000 3:34 PM
Subject: Re: native pthread support in 1.5

On Mon, Aug 28, 2000 at 02:49:45PM -0500, John Maier wrote:

 > How then do we (NetBSD) support Linux compat pthread in 1.5?

If a threads package lives entirely in userland, then support in emulation
is obviously quite trivial.

Linux's threads package uses the __clone(2) system call, which we also
provide emulation for.

The issue is that threads support is more than just providing the right
system calls.  There's also some fairly difficult integration work into
the C library that needs to happen in order to support threads.

 > Is the pthread stuff (on Linux) a library or native to the Linux kernel?

It's a combination of both.  The Linux threads library uses the __clone(2)
system call.

Now, as a result of that, Linux threads are a bit difficult to work with,
and they've even added API components to work around problems with their
approach to threads.

NetBSD is currently (quite actively, I might add, as I discuss progress
and issues with the developer who's working on it pretty much every day)
a pthreads implementation which uses an approach very similar to that
used by Solaris.

I think you'll be quite happy with the result of this work, and in the
mean time, please use unproven-pthreads or PTL2 (or PTH or whatever else
might be available).  These are perfectly reasonable stop-gap measures.

Yes, I readily acknowledge that it sucks not having pthreads ship out
of the box, but I'll also point out that the pthreads implementations
available on the other free systems have some unfortunate negatives
associated with them ... NetBSD is learning from the mistakes made there,
and taking an approach to the implementation that addresses many of them.

        -- Jason R. Thorpe <>