[libdispatch-dev] Experimental Pthread Work Queue Support for FreeBSD

Stacey Son sson at freebsd.org
Tue Dec 15 12:40:38 PST 2009


Hi,

Robert was the one that asked me if I could look into this so hopefully he has not already done this...  :)

Currently the GCD port for FreeBSD uses the user-level thread worker code in libdispatch and not the pthread_workqueue_*_np() calls like darwin.   The pthread work queue code below pretty much follows the same idea that darwin uses.   It is a kernel assisted thread pool implementation. The kernel manages the creation and destruction of threads in the work pool based on if it sees lots of the worker threads blocking, being idle for a (relatively) long time, etc.   I don't know if it performs any better than the user-level thread pool since I have not yet done any performance testing. 

Best Regards,

-stacey.


On Dec 15, 2009, at 1:26 PM, David Leimbach wrote:

> I think Robert Watson has already done this?
> 
> My understanding is that 8-STABLE supports this.
> 
> Am I wrong?
> 
> Dave
> 
> On Tue, Dec 15, 2009 at 8:09 AM, Stacey Son <sson at freebsd.org> wrote:
> Hi All,
> 
> Just in time for the holidays I have created a couple of patches for FreeBSD-Current to add apple-like pthread workqueues.   You can find the patches at:
> 
>        http://people.freebsd.org/~sson/thrworkq/
> 
> The first patch (kern_thrworkq_*.diff) adds the kernel support and thr_workq() system call.  To compile it into the kernel "options THRWORKQ" needs to be added to the kernel config file.  The second patch (pthread_workqueue_*.diff) is for the libthr code and adds the pthread_workqueue_*_np() functions.  (See http://people.freebsd.org/~sson/thrworkq/pthread_workqueue.3.txt for the man page.)   I have only done a limited amount of testing so I am sure there are bugs.   Any questions, comments, bug reports, and/or patches are welcomed.
> 
> Thanks,
> 
> -stacey.
> _______________________________________________
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-dev/attachments/20091215/a5630887/attachment.html>


More information about the libdispatch-dev mailing list