What is a thread pool and why is it used?

A thread pool is a group of pre-created and reusable worker threads managed by the Executor Framework. Instead of creating a new thread for every task, tasks are submitted to the thread pool, and available threads execute them. This approach improves application performance, reduces resource consumption, and provides better control over concurrent task execution.

Key Points

Example

Consider a web application receiving thousands of user requests. Creating a new thread for every request would consume significant CPU and memory resources. A thread pool maintains a fixed number of threads and assigns incoming requests to available threads, improving scalability and efficiency.

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolExample {

    public static void main(String[] args) {

        ExecutorService executor = Executors.newFixedThreadPool(3);

        for (int i = 1; i <= 5; i++) {
            int taskId = i;

            executor.submit(() ->
                System.out.println("Executing Task " + taskId +
                        " by " + Thread.currentThread().getName())
            );
        }

        executor.shutdown();
    }
}

Interview Tip

A concise interview answer is: "A thread pool is a collection of reusable threads managed by the Executor Framework. It improves performance by avoiding repeated thread creation, efficiently manages system resources, and provides controlled concurrent execution of tasks."

Last updated: 16 July 2026

Previous question: What is the Executor Framework in Java?

Next question: What is the difference between fixed thread pool and cached thread pool?

More Core Java - Level III interview questions

All Core Java - Level III questions