September
2004, Issue 170
Test Your
EQ
|
Answer
8A
single CPU can switch contexts (threads or processes)
via only two mechanisms: cooperatively via a system call
or preemptively via an interrupt. Obviously, one would
never make a context-switching system call in the middle
of an atomic sequence, so the only other requirement is
that interrupts be disabled for the duration of the sequence
to prevent a preemptive context switch. This is known
as a “critical section.” Care must be taken to keep critical
sections as short as absolutely possible, because they
affect the latency and jitter of all interrupts in the
system.
Contributor:
David Tweed