Received: from SOUTH-STATION-ANNEX.MIT.EDU by po7.MIT.EDU (5.61/4.7) id AA03315; Sun, 10 Dec 95 23:24:43 EST
Received: from LOLA-GRANOLA.MIT.EDU by MIT.EDU with SMTP
	id AA27415; Sun, 10 Dec 95 23:24:48 EST
Received: (from ghudson@localhost) by lola-granola.MIT.EDU (8.6.11/8.6.11) id XAA05820; Sun, 10 Dec 1995 23:24:49 -0500
Message-Id: <199512110424.XAA05820@lola-granola.MIT.EDU>
To: proven@MIT.EDU
Subject: Chris G Demetriou: John Birrell: Re: pthreads (?) on NetBSD/Alpha?
Date: Sun, 10 Dec 1995 23:24:48 EST
From: Greg Hudson <ghudson@MIT.EDU>


I've sent a reply to this; I'll forward it to you when I get it.

------- Forwarded Message

Replied: Sun, 10 Dec 1995 23:19:08 EST
Replied: "Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU> netbsd-developers@netbsd.org, cgd@BALVENIE.PDL.CS.CMU.EDU"
Received: from SOUTH-STATION-ANNEX.MIT.EDU by po6.MIT.EDU (5.61/4.7) id AA26062; Sun, 10 Dec 95 22:53:58 EST
Received: from pain.lcs.mit.edu by MIT.EDU with SMTP
	id AA24951; Sun, 10 Dec 95 22:53:22 EST
Received: (from daemon@localhost) by pain.lcs.mit.edu (8.6.12/8.6.9) id WAA12034; Sun, 10 Dec 1995 22:29:11 -0500
Received: from BALVENIE.PDL.CS.CMU.EDU by pain.lcs.mit.edu (8.6.12/8.6.9) with SMTP id WAA12007 for <netbsd-developers@netbsd.org>; Sun, 10 Dec 1995 22:28:44 -0500
Received: from localhost by BALVENIE.PDL.CS.CMU.EDU id aa14378;
          10 Dec 95 22:28 EST
To: netbsd-developers@netbsd.org
Cc: cgd@BALVENIE.PDL.CS.CMU.EDU
X-Copyright: Copyright 1995, Christopher G. Demetriou.  All rights reserved.
X-Notice: Duplication and redistribution prohibited without consent of
	  the author.
Subject: John Birrell: Re: pthreads (?) on NetBSD/Alpha?
Date: Sun, 10 Dec 1995 22:28:22 -0500
Message-Id: <561.818652502@BALVENIE.PDL.CS.CMU.EDU>
From: Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU>
Sender: owner-netbsd-developers@NetBSD.ORG
Precedence: first-class
X-Loop: netbsd-developers@NetBSD.ORG

John Birrell, one of the earliest users of NetBSD/Alpha mentioned that
he got thread support working on the alpha a few days ago.  I asked
for diffs, etc., assuming that it was based on Chris Provenzano's
pthreads library...  "Wrong."

I got the following back, and am forwarding it with permission.  Any
comments?  I've thought for a while that, as long as it doesn't cost
much, making thread-safe versions of various libraries the _default_
is a good idea...


chris

- ------- Forwarded Message

Replied: Sun, 10 Dec 1995 19:04:43 -0500
Replied: "John Birrell <cimaxp1!jb@werple.net.au> "
Received: from BALVENIE.PDL.CS.CMU.EDU by NIAGARA.NECTAR.CS.CMU.EDU id aa12769;
          9 Dec 95 19:30:15 EST
Received: from werple.mira.net.au by BALVENIE.PDL.CS.CMU.EDU id aa14423;
          9 Dec 95 19:29 EST
Received: from cimaxp1.UUCP (Ucimlogi@localhost) by werple.net.au (8.7/8.7.1) with UUCP id KAA14329 for Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU; Sun, 10 Dec 1995 10:42:11 +1100 (EST)
Message-Id: <199512092342.KAA14329@werple.net.au>
X-Authentication-Warning: werple.net.au: Ucimlogi set sender to cimaxp1!jb using -f
Received: by cimaxp1.cimlogic.com.au; (5.65/1.1.8.2/10Sep95-0953AM)
	id AA00618; Sun, 10 Dec 1995 10:42:17 +1100
From: John Birrell <cimaxp1!jb@werple.net.au>
Subject: Re: pthreads (?) on NetBSD/Alpha?
To: Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU>
Date: Sun, 10 Dec 1995 10:42:17 +1100 (EST)
Cc: jb@cimlogic.com.au
In-Reply-To: <1029.818544916@BALVENIE.PDL.CS.CMU.EDU> from "Chris G Demetriou" at Dec 9, 95 04:35:16 pm
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text

Chris,

There's a bit a story to this. Having had a good look at libpthread in
NetBSD (i386 only), I concluded that it should be trashed. It doesn't
contain sufficient functionality to get a serious threaded application to
work.

> 
> so, was it pthreads that you ported to NetBSD/Alpha?  if so, could you

I started with Chris Provenzano's MIT pthreads using NetBSD/i386-current.
His test programs built and ran and therefore supposedly proved that the
pthreads library worked. I built our threaded applications (working on OSF/1,
VxWorks and LynxOS) against the pthread library and couldn't get our test
harnesses to run at all. So I started debugging the pthread library. As it
turned out, there were a lot of bugs, some the result of the basic design.
Provenzano tried to implement user-space file descriptors that don't match
those that the kernel knows about. He builds the pthread library from his own
libc code that was NetBSD version 0.9. Instead of having the syscalls return
their normal values, he has them return "minus errno". His scheduling code is
spread throughout the libc functions that are duplicated in libpthread. And
the list goes on....

We (CIMlogic) reviewed the pthread design and our ability to support code
based on it and NetBSD. The outcome of that review was the decision to create
and support a local version of NetBSD's libc that could be built non-threaded
and threaded from the same source. [You might remember that I have mentioned
this a few times in mail] We modified NetBSD libc source and added our own
scheduler.

Before NetBSD announced the release of 1.1, we faced the issue of what OS
we would ship customers on the i386 platform. We decided to go with FreeBSD
instead of NetBSD simply because there was a formal release available on
CD (no flames, please 8-). The subject of pthreads came up on the
FreeBSD-hackers mailing list about the same time as our decisions were being
made. I commented about the problems with pthreads. This lead to the decision
by the FreeBSD core to add thread support to FreeBSD's libc in a way that
would...

(a) have no effect on existing programs (meaning that it had to be possible to
    build the normal libc);

(b) allow a threaded version of libc (libc_r.a) to be built that would have a
    user-thread implementation;

(c) the user-thread implementation had to allow a pthread library to be built.

The directory structure we're using is..

/usr/src/lib/libc              - Normal libc stuff with edits to do
                                 #ifdef _THREAD_SAFE where required.
/usr/src/lib/libc_r            - Makefiles reference source in libc where the
                                 same source is used; thread specific source
                                 is in the libc_r tree.
/usr/src/lib/libc_r/uthread    - Contains our user-thread implementation which
                                 can be used _instead_ of Provenzano's
                                 pthread user-thread implementation.
/usr/src/lib/libc_r/pthread    - Provenzano's user-thread implementation will
                                 go here (eventually, although it is staying
                                 a FreeBSD port [in their language] for the
                                 time being).

Now we're committed to _both_ NetBSD (for Alpha) and FreeBSD (since they
can give us a system that comes with threads and a lot of working
applications). We'll be maintaining only a few pieces of FreeBSD source
locally. For NetBSD there is much more code for us to support locally because
I have not (yet) convinced J.T. to modify NetBSD's libc in the same way that
FreeBSD is being modified. I was sort of hoping the Provenzano would have some
success since he comes from MIT and has contributed to *BSD for some time.
He is keen to get a threaded libc that can be used with X thread support.

> please:
> 	(1) send the diffs back to the author (i'd like to make
> 		pthreads support NetBSD/Alpha out of the box),

Chris Provenzano says he has been talking to mycroft about integrating
pthreads into NetBSD's libc. I haven't heard whether anything is to come of
this. I'm still trying to persuade J.T. to change NetBSD's errno 
implementation to call __error so that all libraries built with NetBSD can
be linked into a threaded program.

We won't be working with pthreads anymore.

> 	(2) send me the diffs (from the latest version), and

Don't have 'em. Can't (won't) do 'em. 8-).

> 	(3) point me to the latest pthreads release (I forget where
> 		it is...  8-)

Chris Provenzano's home page is...

http://www.mit.edu:8001/people/proven/pthread.html

The ftp site is (I think)...

sipb.mit.edu:/pub/pthreads

Provenzano's home page references this.

> 
> I'd like to play around with them a bit....

In the short term, I'm not sure there is much I can do to help. It takes
quite a while to get the build of /usr/src/lib/libc_r right and I'm currently
only working on doing this for FreeBSD.

Of course, if you can influence NetBSD core to modify libc for thread support,
then everyone can 'play around with them a bit'. 8-). Trevor Blackwell
expressed an interest too.

> 
> thanks.
> 
> 
> later,
> 
> chris
> 

Regards,


- - -- 
John Birrell                                CIMlogic Pty Ltd
jb@cimlogic.com.au                          119 Cecil Street
Ph  +61  3 9690 9600                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137

- ------- End of Forwarded Message


------- End of Forwarded Message

