CPUs consume data. Memory produces data. CPUs are very fast compared to memory. If the consumer can’t get the product fast enough, there is a bottleneck.

The Producer Consumer Problem

  • You have 2 tasks
  • one that writes a result and the other reads a result
  • If task 1 writes a result which task 2 reads, task 1 overwrites the result task 2 is reading
  • The result should not be overwritten by task 1 until task 2 is finished reading
  • Task 2 should not try to access the result until task 1 is done writing