Subject: Re: What is happening with libpthread???
To: Christian Kuhtz <>
From: John Birrell <>
List: current-users
Date: 01/20/1997 20:49:28
Christian Kuhtz wrote (very long lines!):
> Can anyone comment on what the status of this work in progress is?
> And if there's someone who is actively working on it, could you possible
> comment on this? ;-)  Is there an ETA for pthreads?

I'm working on it, but I wouldn't like to give an ETA because I don't have
a design that is acceptable to NetBSD.

> Is it really such a great idea to combine libc with libpthreads?

The NetBSD approach is to make the normal libc re-entrant and to avoid
duplicating compiled code in libc and libpthread. This isn't easy to

> Especially with all the architecture dependencies in any kind of
> architecture.

There are only a few architecture specific bits of code:

1.  Setting up a jmpbuf during thread creation.
2.  Saving and restoring state.

On NetBSD/Alpha (1) is 4 lines of code and (2) is just calls to setjmp
and longjmp.

On NetBSD/i386 (1) is 2 lines of code and (2) is calls to setjmp and longjmp
plus 2 lines of code with each call.

But none of this needs to go in libc. It is only in libpthread. There
are no libc/libpthread architecture specific issues that affect libc.

> It seems to me, while it is a neat idea to take the approach above,
> it is generally a much faster implemented approach to build an external
> libpthread in addition to libc.

The 'right' design is what NetBSD is about.

> For other reasons than pthreads being an integral part of threadsafe
> calls to libc, I have never seen anyone take this approach, unless the
> OS itself is multithreaded, which NetBSD isn't.
> Care to comment on that? 

Nope. 8-)

> Best regards,
> Chris
> PS: Yet another reason to run a NetBSD server or NetBSD API compliant
> server on a Mach mk and built Pthreads on top of Mach C-Threads. 8-]

Why run NetBSD at all then?

John Birrell                                CIMlogic Pty Ltd;           119 Cecil Street
Ph  +61  3 9690 6900                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137