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

Is ThreadPool per AppDomain?

Hi All !

Sorry, I could not find it :-(
If the threadpool would be per application domain, I could just create
another AppDomain to get another ThreadPool there. Alternately, I would
have to opt to some free ThreadPool implementations.

Any help would be great!

Thanks so far and
best regards,
Manfred
Sep 10 '06 #1
8 4878

"mabra" <mabra@homewrote in message
news:uv**************@TK2MSFTNGP04.phx.gbl...
| Hi All !
|
| Sorry, I could not find it :-(
| If the threadpool would be per application domain, I could just create
| another AppDomain to get another ThreadPool there. Alternately, I would
| have to opt to some free ThreadPool implementations.
|
| Any help would be great!
|
| Thanks so far and
| best regards,
| Manfred

Nope, one per process.

Willy.
Sep 10 '06 #2
Manfred,

The threadpool is pretty tuned to what your machine can handle. What is
it that you are trying to do? Why do you need more threads?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mabra" <mabra@homewrote in message
news:uv**************@TK2MSFTNGP04.phx.gbl...
Hi All !

Sorry, I could not find it :-(
If the threadpool would be per application domain, I could just create
another AppDomain to get another ThreadPool there. Alternately, I would
have to opt to some free ThreadPool implementations.

Any help would be great!

Thanks so far and
best regards,
Manfred

Sep 10 '06 #3
Hello Nicholas and All,

thanks first for the reply.

I need a lot of separate threads for longer running tasks [several
minutes], each connecting to other machines;Currently about 100. So far
I understand, I should use the threadpool only for shorter jobs. I could
easily create that amount of threads outside the pool and - due to the
nature of the jobs - they will not necessarily use too much cpu. That's
how I do it currently. But if the number of threads increases, that's
not a good solution and I do not need to have them all running
concurrently. From this point of view, the threadpool would be best. On
the other hand, I also use a lot of events and timers and I just
hesitate to schedule my about 100 additional thread to the theradpool
also. So the question about just another threadpool came to my mind.

Thanks so far and
best regards,
Manfred

Nicholas Paldino [.NET/C# MVP] wrote:
Manfred,

The threadpool is pretty tuned to what your machine can handle. What is
it that you are trying to do? Why do you need more threads?

Sep 10 '06 #4
Manfred,

I think that you should first look at the tasks that you are performing.
If you can break those tasks down into smaller sub tasks, then you can load
them up into the thread pool, and that would be a better solution.

For example, you say you are connecting to other machines. How are you
connecting to them? Are you doing it over the network, performing database
or file operations? If so, perhaps you should use the async methods, and
then have a callback which will inform you when those operations are done.
Most of these will rely on IO completion ports, and not take up threadpool
threads.

Can you give some more information on how you are connecting to those
other machines?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mabra" <mabra@homewrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
Hello Nicholas and All,

thanks first for the reply.

I need a lot of separate threads for longer running tasks [several
minutes], each connecting to other machines;Currently about 100. So far I
understand, I should use the threadpool only for shorter jobs. I could
easily create that amount of threads outside the pool and - due to the
nature of the jobs - they will not necessarily use too much cpu. That's
how I do it currently. But if the number of threads increases, that's not
a good solution and I do not need to have them all running concurrently.
From this point of view, the threadpool would be best. On the other hand,
I also use a lot of events and timers and I just hesitate to schedule my
about 100 additional thread to the theradpool also. So the question about
just another threadpool came to my mind.

Thanks so far and
best regards,
Manfred

Nicholas Paldino [.NET/C# MVP] wrote:
>Manfred,

The threadpool is pretty tuned to what your machine can handle. What
is it that you are trying to do? Why do you need more threads?
Sep 10 '06 #5

"mabra" <mabra@homewrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
| Hello Nicholas and All,
|
| thanks first for the reply.
|
| I need a lot of separate threads for longer running tasks [several
| minutes], each connecting to other machines;Currently about 100. So far
| I understand, I should use the threadpool only for shorter jobs. I could
| easily create that amount of threads outside the pool and - due to the
| nature of the jobs - they will not necessarily use too much cpu. That's
| how I do it currently. But if the number of threads increases, that's
| not a good solution and I do not need to have them all running
| concurrently. From this point of view, the threadpool would be best. On
| the other hand, I also use a lot of events and timers and I just
| hesitate to schedule my about 100 additional thread to the theradpool
| also. So the question about just another threadpool came to my mind.
|
| Thanks so far and
| best regards,
| Manfred
|
| Nicholas Paldino [.NET/C# MVP] wrote:
| Manfred,
| >
| The threadpool is pretty tuned to what your machine can handle.
What is
| it that you are trying to do? Why do you need more threads?
| >
| >

When performing network IO in such scenario, you should use the asynchronous
network methods (BeginXXX/EndXXX), these use Completion Port threads.

Willy.
Sep 10 '06 #6
Hi !

It's complicated to describe. The application makes some management
tasks on a larger number of computers and I have WMI based connections,
access to remote files and the registry. This also has to be made in a
impersonated way [I am using .Net 1.1], because not all the environment
is on the same domain :-(

My handiest task is a class, which checks some files, the registry and
then connects via WMI [where the impersonation thing is not a problem]
to read a lot of classes. I just create a separate thread for this,
that's that easy ;-)

I know, this is sub-optimal ;-)
but better to handle with my experience. Otherwise, I had to break down
the class in more simpler sub-tasks, but for registry access - so far I
remember correctly - there is no chance to make async IO. Event the WMI
[explicit] connects have no async, as far as I understand this. I just
have to wait and then I start several queries [which itself most of them
could be async, which drive some higher programming effort].

So I came onto the idea to ask about the threadpool and/or use one of
the freee available versions as an additional pool.

I do not know, what all uses completion ports and how I can do async Io
in a impersonated way. I am also afraid of, that the free threadpool
implementations dont's allow this.

I'll keep in mind, what you recommend!

Thanks a lot,
Manfred

Nicholas Paldino [.NET/C# MVP] wrote:
Manfred,

I think that you should first look at the tasks that you are performing.
If you can break those tasks down into smaller sub tasks, then you can load
them up into the thread pool, and that would be a better solution.

For example, you say you are connecting to other machines. How are you
connecting to them? Are you doing it over the network, performing database
or file operations? If so, perhaps you should use the async methods, and
then have a callback which will inform you when those operations are done.
Most of these will rely on IO completion ports, and not take up threadpool
threads.

Can you give some more information on how you are connecting to those
other machines?

Sep 11 '06 #7
Hi Williy!

Thanks for your reply.
I shortly answered Nicolas question "above" ...

Best regards,
Manfred

Willy Denoyette [MVP] wrote:
"mabra" <mabra@homewrote in message
news:e$**************@TK2MSFTNGP02.phx.gbl...
| Hello Nicholas and All,
|
| thanks first for the reply.
|
| I need a lot of separate threads for longer running tasks [several
| minutes], each connecting to other machines;Currently about 100. So far
| I understand, I should use the threadpool only for shorter jobs. I could
| easily create that amount of threads outside the pool and - due to the
| nature of the jobs - they will not necessarily use too much cpu. That's
| how I do it currently. But if the number of threads increases, that's
| not a good solution and I do not need to have them all running
| concurrently. From this point of view, the threadpool would be best. On
| the other hand, I also use a lot of events and timers and I just
| hesitate to schedule my about 100 additional thread to the theradpool
| also. So the question about just another threadpool came to my mind.
|
| Thanks so far and
| best regards,
| Manfred
|
| Nicholas Paldino [.NET/C# MVP] wrote:
| Manfred,
| >
| The threadpool is pretty tuned to what your machine can handle.
What is
| it that you are trying to do? Why do you need more threads?
| >
| >

When performing network IO in such scenario, you should use the asynchronous
network methods (BeginXXX/EndXXX), these use Completion Port threads.

Willy.

Sep 11 '06 #8

"mabra" <mabra@homewrote in message
news:uO**************@TK2MSFTNGP05.phx.gbl...
| Hi Williy!
|
| Thanks for your reply.
| I shortly answered Nicolas question "above" ...
|

Ok, I see, you are using WMI which uses RPC's over SMB, that means that you
don't use any of the asynch IO mechanism in .NET, so forget about the
Completion ports.
For this kind of application I would base my design on "normal" managed
threads and not use threads from the pool. Depending on the number of
computers to manage, the number an type of RPC's you are executing (that is
the type of queries) and the available resources (CPU, memory and network)
in the management workstation, I would dedicate one thread per workstation
to start with, if the number of workstations/CPU is too high (say 200) I
would opt to implement my own pool of threads and use a watchdog thread that
dynamically injects/retires threads into the pool depending on the CPU and
network load threshold.

Willy.
Sep 12 '06 #9

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: Chris | last post by:
Hi I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have...
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...
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...
5
by: Peter Kirk | last post by:
Hi, I see in the ThreadPool documentation that the pool has a default limit of 25 threads. Is it correctly understood that this limit is for my entire application? So if I have several...
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...
8
by: Jim Kane | last post by:
I've written a c# web service. When a request is received I need to download a potentially large file from another site. To do that I was starting a new thread using QueueUserWorkItem but to my...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.