Hi Folks, There is a facility in the OpenSolaris kernel called Task Queues that make it downright easy to dispatch tasks to threads without having to do the thread management yourself. This framework is extensively used in the the OpenSolaris kernel and is also used by a ZFS userland library for thread handling. For the full details please see: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/taskq.c
There are extensive comments at the top of that file. Now this is eminently useful for general application programming, letting the developer dispense with thread handling code and focus on the algorithm. So i went ahead and pulled out the taskQ code out of libzpool and created a new library named "intelligently" as "libtaskq"! I currently have a buildable library with a sample program that does a very simple multithreaded file copy using "tasks" for each thread. There are several possibilities to extend this for multithreaded/parallel programming tasks. The source code can be found here: http://belenix.svn.sourceforge.net/viewvc/belenix/trunk/misc/libtaskq/ You can check out that piece using this command: svn co https://belenix.svn.sourceforge.net/svnroot/belenix/trunk/misc/libtaskq libtaskq The sample program is in mcp.c. However this location is temporary as this is a separate project and not related to BeleniX. I have registered for project hosting on sf.net since I intend to make this a cross-platform framework. I am emailing this list and also tools-discuss since I could not figure out which community group is appropriate for this kind of software. Listed below are a bunch of ideas that I have around this piece: * Make it portable to BSD and Linux. This means using POSIX thread interfaces. * Provide build-time support for different allocators apart from Umem: libc malloc, Hoard etc. * Provide support for different programming models like for eg. BSP. * Build extensions for different languages like Python. * Support dispatch of the Blocks C language extension, see Apple's Grand Central Dispatch: http://libdispatch.macosforge.org/ * Extend to distributed task queues ? * Can this interoperate with OpenMP ? * Provide fine-granied task control like Processor binding. * Possibly even extend it to provide out of the box support for alternate parallel hardware platforms like the Cell BE. Regards, Moinak. -- ================================ http://www.belenix.org/ http://moinakg.wordpress.com/ _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org