ThreadPool behaviour when reach MaxLimit.

O

objectref

Hi to all,

does any one know the default behaviour of ThreadPool when all threads there
are busy and requests are available in the queue ??

I mean, the limit of worker threads a thread pool can host/manage is 25.
If we have 25 busy threads in the pool and at this time we try to queue
another job
there, what will be happened ? Will the pool wait for just one busy thread
to
complete (Blocking operation for the 26 job) and then the new job take it's
place and executes
or it will create and spawn a thread of the Thread class ??

The documentation states that "If all thread pool threads are constantly
busy, but there is pending work in the queue, the thread pool will, after
some period of time, create another worker thread. However, the number of
threads will never exceed the maximum value."

I am very anxious about this because i have built an app that may (at any
given time) have to work in
parallel more thatn 25 threads (pool limit).
The documentation also states that one reason NOT using a ThreadPool but
create and manage Thread
object on your own is when
"If you have a task that might run a long time (and therefore block other
tasks). "


thanks for any light on this!

objectref
 
R

Reginald Blue

objectref said:
does any one know the default behaviour of ThreadPool when all
threads there are busy and requests are available in the queue ??

It blocks waiting for a thread to finish.
I am very anxious about this because i have built an app that may (at
any given time) have to work in
parallel more thatn 25 threads (pool limit).
The documentation also states that one reason NOT using a ThreadPool
but create and manage Thread
object on your own is when
"If you have a task that might run a long time (and therefore block
other tasks). "

This is good advice, if you don't want it to wait.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top