F.12 Chapter [*]

Quick Quiz [*].1: 
What SMP coding errors can you see in these examples? See time.c for full code.
 
Answer:
  1. Missing barrier() or volatile on tight loops.
  2. Missing Memory barriers on update side.
  3. 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:

  1. The consumer might be preempted for long time periods.
  2. A long-running interrupt might delay the consumer.
  3. 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