473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ThreadPool. Why why why is so difficult to set the max size? :(

AA
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS

So, somebody know another way or know something that I don't

Thanks a lot

AA
Nov 15 '05 #1
11 3342
Roll yer own. Simple array of 50 threads or whatever :D

Would be nice to have some greater control over this, in my view its a half
assed effort from them again.


"AA" <aa@personal.net.py> wrote in message
news:#B**************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS
So, somebody know another way or know something that I don't

Thanks a lot

AA

Nov 15 '05 #2
The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS
So, somebody know another way or know something that I don't

Thanks a lot

AA

Nov 15 '05 #3
If you need specific gurantees, i dont recommend using the threadpool.


"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:#y*************@TK2MSFTNGP11.phx.gbl...
The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw too that is very complicate to change the ThreadPool size and if I want, I need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to
others OS

So, somebody know another way or know something that I don't

Thanks a lot

AA


Nov 15 '05 #4
100
Thread pool is more than an array of thread objects, though.

"bwahahahaha" <bw*******@bwahahaha.org.ie> wrote in message
news:uP**************@TK2MSFTNGP11.phx.gbl...
Roll yer own. Simple array of 50 threads or whatever :D

Would be nice to have some greater control over this, in my view its a half assed effort from them again.


"AA" <aa@personal.net.py> wrote in message
news:#B**************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw too that is very complicate to change the ThreadPool size and if I want, I need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to
others OS

So, somebody know another way or know something that I don't

Thanks a lot

AA


Nov 15 '05 #5
AA
I think that with .net we are not only developing simple clients
applications, maybe (in my case) i'm developing a very complete server
application that requiere thousands of simultaneous transactions and my
server will be run alone in a four processor machine.

So, I think that this is a microsoft error, and for this reason a Toub (from
microsoft) designed the ManagedThreadPool. With the ManagedThreadPool we can
specify the Pool Size

The problem is that .net asynchronous operations, use the framework
ThreadPool and I can't change that. So, in my case the ManagedThreadPool is
not useful

Well, anyway thanks for your answer
AA

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> escribió
en el mensaje news:%2***************@TK2MSFTNGP11.phx.gbl...
The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw too that is very complicate to change the ThreadPool size and if I want, I need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to
others OS

So, somebody know another way or know something that I don't

Thanks a lot

AA


Nov 15 '05 #6

"bwahahahaha" <bw*******@bwahahaha.org.ie> wrote in message news:Ox**************@TK2MSFTNGP10.phx.gbl...
If you need specific gurantees, i dont recommend using the threadpool.


Gurantees like what?

Willy.

Nov 15 '05 #7
The number of threads in the pool is 25 times the number of CPU's per process, on a Quad CPU that gives 100 worker threads not
counting the IO threadpool (default 1000).
The value of 25 is largely sufficient most of the typical server style applications (managed or non managed), if you feel it's not
and you want a portable solution, you will need to build your own theadpool class, in the mean time you can determine the optimal
value using CorSetMaxThreads.

Willy.
"AA" <aa@personal.net.py> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl...
I think that with .net we are not only developing simple clients
applications, maybe (in my case) i'm developing a very complete server
application that requiere thousands of simultaneous transactions and my
server will be run alone in a four processor machine.

So, I think that this is a microsoft error, and for this reason a Toub (from
microsoft) designed the ManagedThreadPool. With the ManagedThreadPool we can
specify the Pool Size

The problem is that .net asynchronous operations, use the framework
ThreadPool and I can't change that. So, in my case the ManagedThreadPool is
not useful

Well, anyway thanks for your answer
AA

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> escribió
en el mensaje news:%2***************@TK2MSFTNGP11.phx.gbl...
The reason that it is so hard to change the max size is because the
thread pool has been optimized to handle the number of processes in
conjunction with the processes running on the machine.

The idea is that if you have so many threads, you actually start to
shoot yourself in the foot with the time wasted in context switches.

I would recommend using the ThreadPool as is.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"AA" <aa@personal.net.py> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw too that is very complicate to change the ThreadPool size and if I want, I need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to

others
OS

So, somebody know another way or know something that I don't

Thanks a lot

AA



Nov 15 '05 #8
Gurantees like when a thread is started.
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...

"bwahahahaha" <bw*******@bwahahaha.org.ie> wrote in message

news:Ox**************@TK2MSFTNGP10.phx.gbl...
If you need specific gurantees, i dont recommend using the threadpool.


Gurantees like what?

Willy.

Nov 15 '05 #9
What kind of guarantee are you looking for? AFAIK when a work item is queued
up and there is no available thread it will create a new one. Do you have
specific timing issues that the threadpool does not satisfy?

"anonymouse" <an********@discussions.microsoft.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Gurantees like when a thread is started.
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...

"bwahahahaha" <bw*******@bwahahaha.org.ie> wrote in message

news:Ox**************@TK2MSFTNGP10.phx.gbl...
If you need specific gurantees, i dont recommend using the threadpool.


Gurantees like what?

Willy.


Nov 15 '05 #10
when you say hard what exactly do you mean? programmatically? it's a config
file setting, you change the number save the file. I missed where it was
difficult.

You really need to understand context switching and thread scheduling before
you go shoot yourself in the foot as Paldino pointed out. If you need more
than 25 threads, you either have very specialized needs or you should be
reexamining your design.

"AA" <aa@personal.net.py> wrote in message
news:#B**************@TK2MSFTNGP12.phx.gbl...
Why microsoft make so hard to change the max Pool Size??

I really need to change it to 50, because I'm using delegates with
BeginInvoke and I saw that they (delegates) use the ThreadPool, but I saw
too that is very complicate to change the ThreadPool size and if I want, I
need to use unmanage resources

http://www.csharpfriends.com/Article...?articleID=201

If I use unmanage resources my application will not be portable to others OS
So, somebody know another way or know something that I don't

Thanks a lot

AA

Nov 15 '05 #11
This is true when the number of threads is <= MaxThreads (25 per process/CPU).
If the pool is exhausted, the queud workitem will wait for a pooled thread to become free, therefore it's important to use the
threadpool only for short running, non blocking tasks.

Willy.
"Dave" <no****************@wi.rr.com> wrote in message news:e%****************@TK2MSFTNGP09.phx.gbl...
What kind of guarantee are you looking for? AFAIK when a work item is queued
up and there is no available thread it will create a new one. Do you have
specific timing issues that the threadpool does not satisfy?

"anonymouse" <an********@discussions.microsoft.com> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Gurantees like when a thread is started.
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uO**************@TK2MSFTNGP09.phx.gbl...

"bwahahahaha" <bw*******@bwahahaha.org.ie> wrote in message

news:Ox**************@TK2MSFTNGP10.phx.gbl...
> If you need specific gurantees, i dont recommend using the threadpool.
>
>
>
>

Gurantees like what?

Willy.



Nov 15 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
1
by: AA | last post by:
I saw that the ThreadPool has a limit of 25 simultaneus thread, but I really need to increase this number. Because I use delegate BeginInvoke and this use the ThreadPool for asyncroneus...
5
by: Duane Pressley | last post by:
I'm looking for someone to help me make sense of the results I'm observing when using the ThreadPool class in a COM-Interop scenario. Here's the set up: 1.. A classic ASP page instantiates and calls...
6
by: Max Adams | last post by:
Threads and ThreadPool's If I use a ThreadPool how can I tell when a thead in the threadpool has exited? I don't want to set a global member variable I would much rather be able to act on an...
1
by: doudou-shen | last post by:
I will use threadpool do some work with threadpool . but I haven't any information about it . who can help me! thank a lot
13
by: orekin | last post by:
Hi There I have been programming C# for a couple of months and am trying to master Threading. I understand that ThreadPool uses background threads (see code example in MSDN page titled...
10
by: Lenn | last post by:
Hello, I have always used a certain design pattern for multithreaded Windows app; Start new worker thread from UI thread, use events to notify UI threads when something happens, update UI...
3
by: Kevin | last post by:
Using this: http://msdn2.microsoft.com/en-us/library/3dasc8as(VS.80).aspx as an example I have a question concerning the reuse of objects. In the example 10 instances of the Fibonacci class...
3
by: UltimateBanoffee | last post by:
Hi, I'm using asp.net 2.0 and I have an understanding issue here! I don't quite understand when the available threads in the ThreadPool are ever used. The application I have running doesn't use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.