kqueue & pthread

Brian Fundakowski Feldman green at freebsd.org
Wed Feb 9 07:51:38 PST 2005


On Wed, Feb 09, 2005 at 06:39:52PM +0300, Dmitry Agaphonov wrote:
> On Wed, 9 Feb 2005 09:49:24 -0500
>         Brian Fundakowski Feldman <green at freebsd.org> wrote:
> 
> BFF> Since you're using user threads, not kernel threads, the kernel can only
> BFF> have one "object" (poll or select list, or kqueue file descriptor) to wait
> BFF> upon at any given time.  Since kqueues are pollable, what happens is
> BFF> that the kqueue along with every other fd being polled/selected are all
> BFF> polled by a single poll(2) system call.  Yes, your kqueue is being used,
> BFF> but it has an indirection of another poll(2) system call determining
> BFF> when your kevent(2) thread should be woken up.
> 
> Brian, thank a lot for your explanation!
> 
> So, pthreads since they are user threads do not provide concurrency on
> multiprocessor systems?

Right, the libc_r implementation specifically.

> And by the way, are there another ways to have kernel threads in FreeBSD 4.x
> applications, rather than use LinuxThreads port or implement it via rfork'ed
> processes?

The LinuxThreads library seems to be the best-supported way.  I don't think
that there should be legal/licensing issues using it.

-- 
Brian Fundakowski Feldman                           \'[ FreeBSD ]''''''''''\
  <> green at FreeBSD.org                               \  The Power to Serve! \
 Opinions expressed are my own.                       \,,,,,,,,,,,,,,,,,,,,,,\


More information about the freebsd-hackers mailing list