Combinations of threads working together make a design pattern. This page is dedicated to
reusable ways to build applications. Examples of thread patterns include the thread pool,
a socket server engine, etc.
Parallel Task Models
- Boss/Worker Model: In this type of model, one thread functions as
the boss and assigns tasks to the worker threads. The worker thread
signals the boss on completion of its task. Alternatively, the boss
polls the workers periodically and assigns tasks when a worker has
completed its task.
- Work Crew Model: In this model, multiple threads work together on
a single task. The task is divided horizontally into pieces that are
performed in parallel, and each thread performs one piece.
- Pipelining Model: In this model, a task is divided into steps.
The steps must be performed in sequence. However, the program is
designed to produce multiple instances of the output, and the steps are
designed to operate in parallel.
Role-specific Models
- Servicing Socket Connections
- Thread per connection
- Dedicated accept thread w/thread pool
- In-memory Hash Table
- Work Engine
|