Restartable atomic sequences are user code sequences which are guaranteed to execute without preemption. This property is assured by checking the set of restartable atomic sequences registered for a process during
cpu_switchto(9). If a process is found to have been preempted during a restartable sequence, then its execution is rolled-back to the start of the sequence by resetting its program counter saved in its process control block (PCB).
The RAS functionality is provided by a combination of the machine-independent routines discussed in this page and a machine-dependent component in
cpu_switchto(9). A port which supports restartable atomic sequences will define
__HAVE_RAS in
<machine/types.h> for machine-independent code to conditionally provide RAS support.
A complicated side-effect of restartable atomic sequences is their interaction with the machine-dependent
ptrace(2) support. Specifically, single-step traps and/or the emulation of single-stepping must carefully consider the effect on restartable atomic sequences. A general solution is to ignore these traps or disable them within restartable atomic sequences.