[Operating System]Thread Pool

What is Thread Pool:
a software design pattern for achieving concurrency of execution in a computer program

It is also called:
a replicated workers/worker-crew model

A thread pool maintains multiple threads waiting for tasks to be allocated for concurrent execution by the supervising program. By maintaining a pool of threads, the model increases performance and avoids latency in execution due to frequent creation and destruction of threads for short-lived tasks
By maintaining a pool of threads, the model increases performance and avoids latency in execution due to frequent creation and destruction of threads for short-lived tasks.
The number of available threads is tuned to the computing resources available to the program, such as parallel processors, cores, memory, and network sockets.
A common method of scheduling tasks for thread execution is a synchronized queue, known as a task queue. The threads in the pool remove waiting tasks from the queue, and place them into a completed task queue after completion of execution.

原文地址:https://www.cnblogs.com/HuisClos/p/8697977.html