How does the behavior of CachedThreadPool differ from that of FixedThreadPool in terms of thread creation and task management?

  • CachedThreadPool creates a fixed number of threads and assigns one to each submitted task.
  • CachedThreadPool creates new threads as needed and reuses previously constructed ones.
  • FixedThreadPool creates a fixed number of threads and assigns one to each submitted task.
  • FixedThreadPool creates new threads as needed and reuses previously constructed ones.
The behavior of CachedThreadPool differs from FixedThreadPool in that it dynamically creates new threads as needed and reuses previously constructed ones. This is suitable for tasks with variable workload. In contrast, FixedThreadPool maintains a fixed number of threads, each assigned to a task, making it ideal for tasks with a consistent workload.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *