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
Which number is denoted by leading zero in java?
Explain JMS in detail.
What is final method in java?
What is rmi and steps involved in developing an rmi object?
What is navigable map in java?
What do you understand by Header linked List?
What is thread safe singleton?
What is array length in java?
What is difference between path and classpath in java?
How will you add panel to a frame?
How do you write methodology?
What is difference between identifier and variable?
What is structure of java heap? What is perm gen space in heap?
How to compare two strings in java program?
What is the mapping mechanism used by java to identify IDL language?