1. Introduction 2. Threads 3. Fair Thread Framework 4. Java FairThreads API 5. Examples 6. Links with Reactive Programming 7. Conclusion |
One has defined a new framework for concurrent programming in Java, based on the notion of a fair thread. Fair threads are run by fair schedulers which give threads equal rights to get the processor and equal rights to receive broadcast events. The FairThreads framework makes a clear separation between the cooperative world and the preemptive one. Fair threads are basically cooperative, and it is the programmer's responsability to program cooperation with other threads. However, there exists a way to embed non-cooperative code in FairThreads, through the notion of a fair process. FairThreads has a clear and simple semantics, relying on the reactive approach. As a consequence, FairThreads programs are basically deterministic and fully portable. Fair threads are of valuable help with uniprocessor machines to get portable, simple, and efficient code. The API of the FairThreads framework and its implementation are available on the Web [3]. AcknowledgmentsThanks to Julien Demaria, Loic Henry-Greard, Xavier Leroy, Fabrice Peix, and Jean-Ferdy Susini for their valuable comments and suggestions on a previous version of the paper. |