threads - how many ?

  • Thread starter Thread starter James
  • Start date Start date
J

James

What is the maximum threads .net can open at one time ?

If there is a max , how do i increase it ?
 
James said:
What is the maximum threads .net can open at one time ?

If there is a max , how do i increase it ?


I am curious why you would want to know that. Creating high numbers of
threads doesn't make much sense, and better solutions with fewer threads can
be found.
 
i wrote a service that does threads pooling. Each threads represent a pc
derived from my pclist.txt

An organisation usually has more than 100++ pc, thus i need to know whethere
there is a limited number of threads
 
James,
I don't believe there is a maximum per se, at least one that you can
actually reach.

As m.posseth suggests, its based on system resources (# of physical &
logical CPUs, amount of memory, amoung other things).

It also depends on what the threads are doing, if they are waiting for IO,
then having 100s probably is not going to hurt anything. However if they are
CPU bound (such as Ray Tracing or calculating actuary tables) then having
more then one per physical/logical CPU is definitely a bad idea.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| What is the maximum threads .net can open at one time ?
|
| If there is a max , how do i increase it ?
|
|
 
James,

You should reconsider your architecture. A solution that creates
threads unbounded is usually inferior to other solutions that only
require a fixed number of threads. In your case, there is a one-to-one
relationship with threads and PCs so the thread count will grow
unbounded depending on the number of entries in the pclist.txt file. A
better approach would be to use the ThreadPool class to queue work
items you may have for each pc. The ThreadPool class will manage the
dispatching of work items to a bounded number of threads in an
efficient manner

Brian
 

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

Back
Top