= coThreads = == Description == coThreads is a [[doc/concurrency.and.parallelism|concurrent]] programming library for OCaml. It enhances the Threads library of the standard OCaml distribution in two dimensions: * coThreads implements the same API of the standard Threads library on different execution engines (process, netwoker(todo)), so that a single copy of source code can be compiled and deployed to different environments without modification * coThreads is also a super set of the standard Threads library, with extra components (STM etc.), functions (spawn etc.) and features (object-level compatibility etc.) == Features == The design of coThreads brings several advantages: === Powerfulness === * The process engine can give you real speedup on multi-core and multi-processor machines, the networker engine (todo) will give you both speedup and scalability. * Combining the original components from the Threads library and the newly added ones, coThreads is a full-fledged toolbox covering two main concurrent programming [[doc/paradigm|paradigms]], namely shared-memory and message passing, with both high-level and low-level constructors. * All constructors (e.g. thread, mutex, condition, event, channel, tvar, stm etc.) are first class values that can be communicated and shared between independent threads. === Compatibility === * Full [[doc/compatibility|compatibility]] with the original Threads library (systhreads and vmthreads), so that you can now deploy your legacy code to new environment for free --- without modifying source code, without learning something new. * Both source-level and object-level compatibility among different execution engines, so that you can keep a single copy of source code as well as a single copy of objects files. === Convenience === * The full library is implemented in user-space, no modification to the OCaml compiler and runtime, so that you can [[doc/usage|use]] it as a set of plain modules. * Switching engines is as easy as changing the include paths of compilation, and it's quite easy to automate the building process over a set of engines (e.g. with lines of pattern rules in your Makefile)