The Producer Consumer Pattern is a work load distribution pattern where the number of worker threads is decoupled from the number of tasks they have to execute. In this video I explain how the producer consumer pattern works in multithreading. You can also implement the producer consumer pattern with processes (instead of threads), but since this video is part of a playlist about Java Concurrency, I will focus on how the producer consumer pattern looks for threads.
Chapters:
0:00 Producer consumer pattern introduction
4:01 Producer consumer pattern use cases
4:24 Reduce foreground thread latency - GUI app
7:21 Reduce foreground thread latency - server
9:50 Load balance between worker threads - recap
10:40 Backpressure management
13:50 Producer consumer Java code example
The Producer Consumer Pattern - text:
http://tutorials.jenkov.com/java-conc...
Java BlockingQueue - text / video:
http://tutorials.jenkov.com/java-util...
• Java BlockingQueue
Java Concurrency - text / video playlist:
http://tutorials.jenkov.com/java-conc...
• Java Concurrency and Multithreading