7. Conclusion

7. Conclusion


Home: Fair Threads in C

Previous chapter: Related Work
Next chapter: Man Pages



1. Introduction
2. Rationale
3. API Overview
4. API
5. Examples
6. Related Work
7. Conclusion
8. Man Pages


In FairThreads, users have control on the way threads are scheduled. Fair threads which are linked to a scheduler are scheduled in a cooperative way by it. When a fair thread unlinks from a scheduler, it becomes an autonomous native thread which can be run in real parallelism, on a distinct processor. An important point is that FairThreads provides users with programming primitives allowing threads to dynamically link to schedulers and to dynamically unlink from them.

Precise Semantics

Linked threads have a precise and clear semantics (which can be formally given). The point is that systems exclusively made of threads linked to one unique scheduler are completely deterministic.


FairThreads offers a very simple framework for concurrent and parallel programming. Simple cooperative systems can be coded in a simple way, without the need of locks to protect data. Instants give automatic synchronizations that can also simplify programming in certain situations.

Compatibility with Pthreads

FairThreads is fully compatible with the standard Pthreads library. Indeed, unlinked fair threads are actually just pthreads. In this respect, FairThreads is an extension of Pthreads, which allows users to define cooperative contexts with a clear and simple semantics, in which threads execute at the same pace and events are instantaneously broadcast.


Auxiliary tasks can be implemented using automata instead of standard fair threads. Implementation of an automaton is lightweight and does not require a dedicated native thread. Automata are useful for short-lived small tasks or when a large number of tasks is needed. Automata are an alternative to standard techniques such as "chunks" or "chores", sometimes used in thread-based programming.


A first implementation of FairThreads is available (under the Gnu Lesser General Public License as a library called fthread [6] which must be used with the standard Pthreads library.

This page has been generated by Scribe.
Last update Tue Sep 2 16:54:13 2003