A Quick Motivating Example
void Queue::InsertAtHead(Item *item) {
item->next = head;
head = item;
}
Suppose two threads, red and blue, share this code and a Queue q.
The two threads both operate on q: each calls q->InsertAtHead().
Their execution is interleaved by interrupts.
Previous slide
Next slide
Back to first slide
View graphic version