Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Thread object vs Threadpool?

Reply
Thread Tools

Thread object vs Threadpool?

 
 
mortb
Guest
Posts: n/a
 
      01-20-2006
Hi all!

In my webb app I'm about to introduce a way of processing long running tasks
in the background.
As the long running task gathers data from a database process them and
compile them into a file appx 80 mbytes large it is a resource demanding
task both of the CPU and the memory.
So I think I should restrict how many of these tasks that should be able to
start and make them run in the background.

First I read about the Thread class and thougth: Fine I'll use a thread and
then I'll write a utility class that will queue the tasks and make them run
either one after one or not too many at a time.
I'd set threads' priority to belowNormal or lowest.

Then I discovered the threadpool class and thought: Hey here's the queuing
abillity I was looking for. But then I found no way of setting the priority
of the thread that would start the long running task and I don't want to
make the web pages serve slowly.

Does anyone have any advice on whether I should use the threadpool or create
thread objects "on my own" in the code?

Thanks in advance!
mortb


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=
Guest
Posts: n/a
 
      01-20-2006
ThreadPool class is mostly used for fire and forget tasks.
Use Thread class if extended control is needed.
-
Milosz Skalecki
MCP, MCAD


"mortb" wrote:

> Hi all!
>
> In my webb app I'm about to introduce a way of processing long running tasks
> in the background.
> As the long running task gathers data from a database process them and
> compile them into a file appx 80 mbytes large it is a resource demanding
> task both of the CPU and the memory.
> So I think I should restrict how many of these tasks that should be able to
> start and make them run in the background.
>
> First I read about the Thread class and thougth: Fine I'll use a thread and
> then I'll write a utility class that will queue the tasks and make them run
> either one after one or not too many at a time.
> I'd set threads' priority to belowNormal or lowest.
>
> Then I discovered the threadpool class and thought: Hey here's the queuing
> abillity I was looking for. But then I found no way of setting the priority
> of the thread that would start the long running task and I don't want to
> make the web pages serve slowly.
>
> Does anyone have any advice on whether I should use the threadpool or create
> thread objects "on my own" in the code?
>
> Thanks in advance!
> mortb
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Terminating a thread from the main thread Charles A. Lackman ASP .Net 3 12-09-2004 02:12 PM
Thread was being aborted in win2003 server. Back ground thread reading MS access database, no redirects or transfers. Johanna ASP .Net 0 10-13-2004 01:32 PM
"Thread was being aborted" error from WebApp using Thread.Sleep. Stephen Miller ASP .Net 3 07-01-2004 11:50 PM
perl 5.8.2/3 - thread started by a thread pawo Perl 0 02-16-2004 01:18 PM



Advertisments