FairThreads: mixing cooperative and preemptive threads in C: Research Articles

  • Authors:
  • Frédéric Boussinot

  • Affiliations:
  • EMP-CMA/INRIA—MIMOSA Project, 2004 route des Lucioles—BP 93, F-06902 Sophia Antipolis, Cedex, France

  • Venue:
  • Concurrency and Computation: Practice & Experience
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

Abstract

FairThreads introduces fair threads which are executed in a cooperative way when linked to a scheduler, and in a preemptive way otherwise. Constructs exist for programming the dynamic linking/unlinking of threads during execution. Users can profit from the cooperative scheduling when threads are linked. For example, data only accessed by the threads linked to the same scheduler does not need to be protected by locks. Users can also profit from the preemptive scheduling provided by the operating system (OS) when threads are unlinked, for example to deal with blocking I/Os. In the cooperative context, for the threads linked to the same scheduler, FairThreads make it possible to use broadcast events. Broadcasting is a powerful, abstract, and modular means of communication. Basically, event broadcasting is made possible by the specific way threads are scheduled by the scheduler to which they are linked (the ‘fair’ strategy). FairThreads give a way to deal with some limitations of the OS. Automata are special threads, coded as state machines, which do not need the allocation of a native thread and which have efficient execution. Automata also give a means to deal with the limited number of native threads available when large numbers of concurrent tasks are needed, for example in simulations. Copyright © 2005 John Wiley & Sons, Ltd.