F.12 Chapter
Quick Quiz
.1:
What SMP coding errors can you see in these examples?
See time.c for full code.
Answer:
- Missing barrier() or volatile on tight loops.
- Missing Memory barriers on update side.
- Lack of synchronization between producer and consumer.
Quick Quiz
.2:
How could there be such a large gap between successive
consumer reads?
See timelocked.c for full code.
Answer:
- The consumer might be preempted for long time periods.
- A long-running interrupt might delay the consumer.
- The producer might also be running on a faster CPU than is the
consumer (for example, one of the CPUs might have had to
decrease its
clock frequency due to heat-dissipation or power-consumption
constraints).
Paul E. McKenney
2011-12-16