473,386 Members | 1,736 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,386 software developers and data experts.

ThreadPool: only 1 ?

hi,

the framework has the ThreadPool class. Very handy.
But as far as I can see this is a singleton (only 1 instance).
Does anybody know a way how to have multiple ThreadPools inside a single
application ?

Regards,

Serge
Nov 15 '05 #1
6 1655
There is only one threadpool per application domain. What are you wanting to
do?

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Serge" <se**********@hotmail.com> wrote in message
news:3f**********************@reader2.news.skynet. be...
hi,

the framework has the ThreadPool class. Very handy.
But as far as I can see this is a singleton (only 1 instance).
Does anybody know a way how to have multiple ThreadPools inside a single
application ?

Regards,

Serge

Nov 15 '05 #2
I have 2 different kind of tasks.

1, delivery system
2, scripting system

these have to run independantly from each other.
Scripts usually take a short time to process, the delivery long. So I don't
want to have the delivery processes hangs up the script processes.

So I wanted to have 2 threadpools running next to each other.
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:u4****************@TK2MSFTNGP12.phx.gbl...
There is only one threadpool per application domain. What are you wanting to do?

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Serge" <se**********@hotmail.com> wrote in message
news:3f**********************@reader2.news.skynet. be...
hi,

the framework has the ThreadPool class. Very handy.
But as far as I can see this is a singleton (only 1 instance).
Does anybody know a way how to have multiple ThreadPools inside a single
application ?

Regards,

Serge


Nov 15 '05 #3
What would a second threadpool do that the first would not? Each thread in
the pool can already run and block independently of the other threads.
Adding a second threadpool would add more available threads but unless you
needed to manage them yourself to add special capabilities it would not
significantly change anything. You might even find that it slows things down
to add more threads as it increases the amount of context switching.
"Serge" <se**********@hotmail.com> wrote in message
news:3f*********************@reader1.news.skynet.b e...
I have 2 different kind of tasks.

1, delivery system
2, scripting system

these have to run independantly from each other.
Scripts usually take a short time to process, the delivery long. So I don't want to have the delivery processes hangs up the script processes.

So I wanted to have 2 threadpools running next to each other.
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:u4****************@TK2MSFTNGP12.phx.gbl...
There is only one threadpool per application domain. What are you
wanting to
do?

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Serge" <se**********@hotmail.com> wrote in message
news:3f**********************@reader2.news.skynet. be...
hi,

the framework has the ThreadPool class. Very handy.
But as far as I can see this is a singleton (only 1 instance).
Does anybody know a way how to have multiple ThreadPools inside a single application ?

Regards,

Serge



Nov 15 '05 #4
Dave <no****************@wi.rr.com> wrote:
What would a second threadpool do that the first would not?


It would block different threads. You could have two pools, one with
long-running tasks and one with short-running tasks. If you only add
the right type of task to each pool, you don't get long-running tasks
blocking short-running tasks, which is what you get with a single pool.
You often only want short-running tasks blocking each other and long-
running tasks blocking each other - that way you end up with a much
shorter latency for short-running tasks than long-running tasks.

I agree with the OP - the current ThreadPool is unfortunately limiting
:(

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #5
N.K
Go for Custome ThreadPools instead of .NET ThreadPool class, There is
implementation by Mike Woodring (Develop mentor) hosted @ his web
site.
"Serge" <se**********@hotmail.com> wrote in message news:<3f*********************@reader1.news.skynet. be>...
I have 2 different kind of tasks.

1, delivery system
2, scripting system

these have to run independantly from each other.
Scripts usually take a short time to process, the delivery long. So I don't
want to have the delivery processes hangs up the script processes.

So I wanted to have 2 threadpools running next to each other.
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:u4****************@TK2MSFTNGP12.phx.gbl...
There is only one threadpool per application domain. What are you wanting

to
do?

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Serge" <se**********@hotmail.com> wrote in message
news:3f**********************@reader2.news.skynet. be...
hi,

the framework has the ThreadPool class. Very handy.
But as far as I can see this is a singleton (only 1 instance).
Does anybody know a way how to have multiple ThreadPools inside a single
application ?

Regards,

Serge


Nov 15 '05 #6

It would block different threads. You could have two pools, one with
long-running tasks and one with short-running tasks. If you only add
the right type of task to each pool, you don't get long-running tasks
blocking short-running tasks, which is what you get with a single pool.
You often only want short-running tasks blocking each other and long-
running tasks blocking each other - that way you end up with a much
shorter latency for short-running tasks than long-running tasks.

I agree with the OP - the current ThreadPool is unfortunately limiting
:(


I never stated otherwise...in fact, in other posts I've advocated custom
thread pools. I just wanted to make sure the OP knew enough to ensure that a
second threadpool would actually be of benefit. Many people mistakenly
believe that they need a large number of threads when it is common that what
they really need is a better understanding of their requirements.

Nov 15 '05 #7

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...
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...
5
by: =?Utf-8?B?RkxEYXZlTQ==?= | last post by:
I'm developing an application that gets data from 100 sources (via telnet connections, but you can think stock quotes from a webservice if you like). I was planning on using the thread pool (25...
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...
7
by: =?Utf-8?B?cmJEZXZlbG9wZXI=?= | last post by:
The following is from a simple Windows application in VS2005, which has button1 and textbox1 dragged onto a form. In StartThreads(), I call ThreadPool.QueueUserWorkItem(), then call WaitOne()....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.