Answer Posted / rajashree
A thread pool is a collection of threads, which you
keep "alive" and use/reuse to process incoming "tasks".
When a new tasks arrives (a typical example is a request to
an HTTP server) you try to find a thread from the
collection, which is idle, and handle the task to it. If no
such thread exists you either wait for one to become
available or add a new thread to the pool (usually there is
an upper limit, though). After the thread has finished
processing the task, it is not terminated, only marked as
idle and ready to be reused for another task.
The main advantages of using a thread pool as opposed to
creating a new thread to handle each new task are:
1) By reusing threads you save the thread
creation/destruction overhead.
2) You have control over the maximum number of tasks that
are being processed in parallel (= number of threads in the
pool).
| Is This Answer Correct ? | 8 Yes | 14 No |
Post New Answer View All Answers
placement papaers of spring computing technology
Is main is a keyword?
Difference between overriding and overloading in java?
What is arrays aslist in java?
Can we have two main methods in a java class?
What is the difference between private & public & friendly classes?
Does java map allow duplicates?
How does hashmap work in java ?
Can list have duplicates in java?
What is meant by object oriented programming – oop?
Explain different ways of creating a thread. Which one would you prefer and why?
Define interface in java?
What are recursive functions?
What is the access scope of a protected method?
What do you mean by stream pipelining in java 8?