Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2000 10:11:27 +0200
From:      Bjorn Tornqvist <bjorn@tornqvist.net>
To:        chris@calldei.com
Cc:        Nate Williams <nate@yogotech.com>, freebsd-hackers@freebsd.org
Subject:   Re: BSD,Posix,Linux Threading - Are they really useable?
Message-ID:  <398534AF.467DE4D5@tornqvist.net>
References:  <398111DA.443B41F9@tornqvist.net> <20000728003913.K37935@holly.calldei.com> <200007281538.JAA22915@nomad.yogotech.com> <20000728140854.L37935@holly.calldei.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Chris Costello wrote:
> 
> On Friday, July 28, 2000, Nate Williams wrote:
> > >    That is incorrect.  FreeBSD's userland pthread implementation
> > > does not block the whole process on I/O.  POSIX does not specify
> > > this behavior either.
> 
> > Actually, sometimes it does (for example when reading from an I/O device
> > where select can't be used succesfully).
> 
>    Hmm.  That's true.  And that's where uthreads has its main
> problems as I understand it.
> 

...which is what I need to avoid. (Chris: Sorry for any confusion
earlier on; When I replied to you I reran the testprogram which then
used intermediate files instead of pipes - thus pthreads seems to work
fine).
But how do I know if my pthreads aren't secretely blocking for a very
short time in read() and write()? Documentation anywere?

> > > > FreeBSD Kernel-threads (dunno what they are called actually) can't be
> > > > used natively!? (Searched the archives and found an explanation that the
> > > > only way to access normal kernel SMP-thread functionality is to use
> > > > LinuxThreads)
> 
> > >    FreeBSD's kernel threads are for separate threads of execution
> > > in the kernel and aren't the same thing as threads for a user
> > > process.
> 
> > You're missing the point.  He's asking for 'kernel threads' so that
> > multiple independant thread of execution for a given 'userland process'
> > can be running simulataneously (virtually on a UP, and realistically on
> > a MP).
> 
>    I thought he had seen the term 'kernel threads' in the context
> of FreeBSD before, likely in the context of kthread_create() in
> the kernel.

Actually I have, but I haven't tried them since I found no documentation
on them (I even emailed peter@freebsd.org (he's listed as maintainer in
sys/kthread.h) but got no reply). Just aswell, seeing how wrong I was.
I think I'll stick to pthreads for now; which will make it easier to
modify the code later on when we have ''real'' threads. (Sorry, I come
from a BeOS background).

Another question for you all: Does FreeBSD have any notion of kernel
mutexes and/or semaphores (that can be used to control concurrent
processes), and that can be shared between processes using pthreads?
pthread_mutex_init is local to a process and thus of little use. (FYI:
The application my company is developing consists of several processes,
all of which must have a couple of worker threads).

TIA,
    Bjorn


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?398534AF.467DE4D5>