Next: 2.4 Blocking Model
Up: 2 Execution Environments
Previous: 2.2 Pure Model
Components that use the impure execution model
act just like those operating in the pure model,
except that they may contain global shared state
and therefore must be treated as a single ``instance''
for synchronization and reentrancy purposes.
For example,
many of the functions in liboskit_kern,
the kernel support library,
set up and access global processor registers and data structures,
and are therefore impure.
Similarly,
some of the functions in the minimal C library,
such as malloc and its relatives,
inherently require the use of global state
and therefore are impure.
The impure execution model has the following properties:
- Impure functions and components may depend on implicit global state,
such as global or static variables or special processor registers.
- Impure functions and components are not reentrant or thread-safe,
except when explicitly stated otherwise.
In order to use these components
in an interruptible or multithreaded/multiprocessor environment,
the client OS must provide appropriate synchronization code.
Many impure components and functions
provide explicit synchronization hooks
for the convenience of the client OS.
For example, the minimal C library's malloc functions
make calls to mem_lock and mem_unlock,
which are empty functions by default
but can be overridden by the client to provide real synchronization;
see Section 9.5 for more information.
- Impure functions and components are not reentrant
even during callbacks from the component to the client OS,
except when explicitly stated otherwise.
In other words, callbacks are assumed to be atomic
as far as the component is concerned.
University of Utah Flux Research Group