previous | start | next

Answers

  1. There are many possible scenarios. Here is one:
  2. One thread calls addFirst and is preempted just before executing the assignment first = newLink. Then the next thread calls addFirst, using the old value of first. Then the first thread completes the process, setting first to its new link. As a result, the links are not in sequence.


previous | start | next