Subject: Re: FD_LOCK, pthreads and drivers
To: mike varga <mike.varga@cavium.com>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 09/13/2001 18:36:35
On Thu, Sep 13, 2001 at 02:27:02PM -0700, mike varga wrote:
> I noticed that while testing the driver I wrote
> for a crypto device, that only one thread
> can be executing within the context of
> my driver at a time.
> 
> The problem is that the pthreads library 
> replaces the ioctl with another that exclusively
> locks the file descriptor with calls to FD_LOCK/
> FD_UNLOCK.

NetBSD does not currently contain a POSIX threads library, so
this cannot be a problem with NetBSD per se.  It's possible that
the third-party thread library you're using does this, but that
really doesn't have anything to do with the NetBSD kernel!

As I expect you know, multiprogramming on Unix systems generally
uses multiple processes, with independent address spaces (parts
of which can be shared under program control) rather than multiple
threads executing within the same address space.  If your driver is
fully reentrant, can't you achieve decent parallelism using this
model?