[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
17.2 Threads
Bigloo supports fair threads (see Section Thread), a
specification of cooperative threads. In this framework a thread must
explicitly or implicitly yield the processor to the scheduler
(see Section Scheduler). Explicit cooperation is achieved by
library functions such as thread-yield!
or
thread-sleep!
. The scheduler does not preempt a running thread to
allocate the processor to another waiting thread. Fair threads have two
drawbacks over preemptive threads:
- Cooperative threads are not skilled to benefit of multi processors platforms.
- Single threads programs must be adapted in order to be ran concurrently.
On the other hand, Fair threads have advantages that make them suitable for a high level programming language such as Scheme:
- Fair threads have a strong and well defined semantic. Multi threaded programs using Fair threads are deterministic thus programs that deploy Fair threads are predictable.
- Fair threads are easier to program with because they hide most the of the concurrent programming pitfalls. In particular, since Fair threads enforce a strong synchronization, there is no need to deploy techniques such as mutex, semaphore or condition variables.
17.2.1 Introduction to Fair Threads | ||
17.2.2 Fair Threads Api | ||
17.2.3 SRFI-18 |
This whole chapter has been written in collaboration with Frédéric Boussinot. It uses materials on Fair threads that can be found at http://www-sop.inria.fr/indes/rp/FairThreads/html/FairThreads.html.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 31, 2014 using texi2html 5.0.