[libdispatch-dev] libdispatch's thread model

Stacey Son sson at FreeBSD.org
Wed Jan 27 08:41:07 PST 2010


On Jan 27, 2010, at 9:41 AM, Mario Schwalbe wrote:

> Hi,
> 
> when dispatching a bunch of jobs (blocks) to a global concurrent queue,
> libdispatch, running on Linux or FreeBSD, always spawns a thread for each job
> submitted. On Mac OS X it works as expected.
> 
> This somewhat interferes with libdispatch's initial intention of a set of
> worker threads - equal to the number of processors - that execute each job
> in turn. Is there some chance to get that fixed?
> 
> I know that Apple's non-posix extension to pthread isn't available.
> Nevertheless, it should be possible to at least use a bounded number of
> worker threads less than MAX_THREAD_COUNT (255). What about dynamically
> setting MAX_THREAD_COUNT (or a similar variable) to the number of processors
> instead?


Can I interest you in testing an experimental patch for FreeBSD that adds pthread work queues?  :-)

See http://people.freebsd.org/~sson/thrworkq/

Best Regards,

-stacey.


More information about the libdispatch-dev mailing list