Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Oct 1999 14:55:18 -0700 (PDT)
From:      Kip Macy <kip@lyris.com>
To:        Rohit Dube <rohitd@dnrc.bell-labs.com>
Cc:        hackers@freebsd.org
Subject:   Re: threaded applications on freebsd 3.3
Message-ID:  <Pine.SOL.4.05.9910121449150.16015-100000@luna>
In-Reply-To: <199910122139.RAA08377@zubin.dnrc.bell-labs.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 12 Oct 1999, Rohit Dube wrote:

> Hi,
> 
> Looking through the mailing list archives, support for threaded
> applications wasn't quite clear to me so I ask here. I have a 
> threaded application working on Red Hat Linux 6.0 which uses pthreads. 
> I  was trying to port it over to FreeBSD 3.3 on a 2 processor intel machine. 
> Not having done threaded work on FreeBSD before, I need to figure out what 
> compiler-options/libraries/kernel to use for the port -
The linux version will work out of the box - however you will have to add
a couple of options to your kernel config file to keep syslog from
overwhelming you with bogus warnings.

> 
> a) What do I need to do, to compile an application which uses pthreads
>    on freebsd 3.3. The gcc (2.7.2.3) man page suggests that it should
>    be invoked with -pthread. Is that sufficient or do I also need to recompile
>    the standard libraries with DTHREAD_SAFE? How about with gcc295 
>    (which comes on the 3.3 CD), it doesn't seem to have this option
>    at all, going by the man page.
-pthread will work just fine. FreeBSD does not have _r calls for
everything yet. Keep in mind that Linux's _r calls are not POSIX
compliant, i.e. they are different from every other UNIX with threads.

> b) The mailing list archives seem to suggest that on freebsd (at least
>    upto 3.2), a (p)thread doesn't map to a kernel thread. I.e scheduling
>    of (p)threads in a process is done in user space.  Is there any way at 
>    all to map a user-level thread to a kernel thread 1:1? Again there seems 
>    to be -kthread option for gcc (2.7.2.3) but none for gcc295.

Don't know - for I/O bound activity kernel threads are a really bad idea.


> c) Is the generic 3.3 default kernel threaded and able to run a multiprocessor
>    machine or do I need to build a custom kernel with specific options.

You will need to rebuild for SMP. See LINT for details.

> 
> Sorry my freebsd is a bit rusty as I have been away for more than a year.
> Thanks,
> --rohit.
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 
> 
				-Kip




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.05.9910121449150.16015-100000>