What is a ThreadPool? And is it more effective than using several separate Threads?

Technology CommunityCategory: AndroidWhat is a ThreadPool? And is it more effective than using several separate Threads?
VietMX Staff asked 3 years ago

Creating and destroying threads has a high CPU usage, so when we need to perform lots of small, simple tasks concurrently, the overhead of creating our own threads can take up a significant portion of the CPU cycles and severely affect the final response time. ThreadPool consists of a task queue and a group of worker threads, which allows it to run multiple parallel instances of a task.

Using ThreadPool is more efficient than having multiple operations waiting to run on a single thread, but it also helps you avoid the considerable overhead of creating and destroying a thread every time you require a worker thread.