chapter sixteen
16 Designing multithreaded programs
This chapter covers
- Designing and creating multiple threads of execution
- Protecting shared resources
- Synchronizing multiple threads of execution
Knowing how to design and develop multithreaded applications allows us to take advantage of a computer’s ability to handle multiple threads of execution. A thread is a path the computer takes through the code as it executes your program. Multithreading means the computer is running multiple paths at the same time. Some applications inherently require simultaneous operations, and we can only design them to be multithreaded. We’ll look at a few typical examples such as an application where simultaneously multiple producer threads enter data into a queue while multiple consumer threads remove data from that queue.