473,386 Members | 1,924 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 and Threads! Help please!

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
ThreadPool.QueueWorkItem, and doesn't create any other Threads. So say
I have 100 users access my application at the exact same time and they
all call on an aspx that takes a couple of seconds to process. I
gather 100 sessions are active, but does that mean 100 threads from
the TreadPool will be required?

My question basically is when/why are threads from the ThreadPool
allocated when ThreadPool.QueueWorkItem is not used.

Thanks to anyone who has time to clear this up for me :o)
Jonathan

Oct 17 '07 #1
3 2470
A soon as a threadpool thread completes it's work it becomes available to
process another unit of work immediately. So even if you actually had 100
"simultaneous" requests (which is hardly possible) this means that less than
100 threadpool threads might be in use at any given time. Additionally, the
Threadpool can be used without explicitly using its QueueUserWorkItem method.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Ul**************@gmail.com" wrote:
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
ThreadPool.QueueWorkItem, and doesn't create any other Threads. So say
I have 100 users access my application at the exact same time and they
all call on an aspx that takes a couple of seconds to process. I
gather 100 sessions are active, but does that mean 100 threads from
the TreadPool will be required?

My question basically is when/why are threads from the ThreadPool
allocated when ThreadPool.QueueWorkItem is not used.

Thanks to anyone who has time to clear this up for me :o)
Jonathan

Oct 17 '07 #2
As a web application can obviously have multiple requests at the same time,
this is of course built in the basic ASP.NET/IIS infrastructure. The
web.config file allows to control some of those parameters such as the max
number of worker threads etc...

(http://msdn.microsoft.com should provide some details about the ASP.NET
architecture).
--
Patrice
<Ul**************@gmail.coma écrit dans le message de news:
11**********************@q3g2000prf.googlegroups.c om...
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
ThreadPool.QueueWorkItem, and doesn't create any other Threads. So say
I have 100 users access my application at the exact same time and they
all call on an aspx that takes a couple of seconds to process. I
gather 100 sessions are active, but does that mean 100 threads from
the TreadPool will be required?

My question basically is when/why are threads from the ThreadPool
allocated when ThreadPool.QueueWorkItem is not used.

Thanks to anyone who has time to clear this up for me :o)
Jonathan

Oct 17 '07 #3

ASP.NET has it's own pool of worker threads for processing HTTP
requests, it does not use the same ThreadPool for those requests. I
believe this pool is much larger than the standard ThreadPool.

ThreadPool is used by many framework classes though, including most
(but not all) calls to BeginXXX methods (WinForms has it's own async
mechanism as does socket IO).

Also note that when the ThreadPool does get exhauseted, queued items
still run they just have to wait until a thread pool thread becomes
available. For that reason it's advised never to run long-running
tasks on a thread-pool thread, use a custom thread for that.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 17 Oct 2007 03:23:25 -0700, Ul**************@gmail.com wrote:
>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
ThreadPool.QueueWorkItem, and doesn't create any other Threads. So say
I have 100 users access my application at the exact same time and they
all call on an aspx that takes a couple of seconds to process. I
gather 100 sessions are active, but does that mean 100 threads from
the TreadPool will be required?

My question basically is when/why are threads from the ThreadPool
allocated when ThreadPool.QueueWorkItem is not used.

Thanks to anyone who has time to clear this up for me :o)
Jonathan
Oct 17 '07 #4

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...
8
by: memememe | last post by:
We are queueing stuff on the thread pool and what we are queueing gets done pretty quick (the method returns fine) but yet its only allowed to run around 25 times, is there anything I need to do to...
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...
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...
0
by: TY | last post by:
Hi Everyone, I have a multithreading application, a typical Main thread that uses the ThreadPool.QueueUserWorkItem method to add new threads to the Thread POOL. I need a way to control the...
1
by: Sam | last post by:
Hi All, I'm trying to write a simple multi-threaded windows service application using ThreadPool and I'm running into the same problem as described by MS article:...
8
by: mabra | last post by:
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...
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...
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
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
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...
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,...

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.