Any ideas?

  • Thread starter Thread starter Mullin Yu
  • Start date Start date
M

Mullin Yu

I want to have a controller class to do

- initilization: create a thread pool with max 10 thread
- get ten records from the db every time
- assign each record to one thread

worker thread
- do the application logic
- once finish, tell the controller class

once all the ten worker threads finish the job, the controller gets the next
batch of ten records from the db, and then assign to the worker thread

1. is it a good design?
2. any pattern i can use
3. any simple coding on the web illustrating the concept of setting max
thread no., controller knows all the worker thread finished the job

thanks!
 
Hi,

As far as I know, the number of threads in the thread pool cannot be set at
run time and is governed by a setting in the machine.config file. Then,
there seems to be no sense in paralleling jobs competing for the same
hardware resource - one physical printer cannot print two documents
simultaneously (but who knows, may be yours can :-) - the same is true for
fax. So I would probably start three threads - one for printer, one for fax
and one for e-mail and would establish three thread-safe queues where jobs
of the appropriate type would be added.
 
Dmitriy Lapshin said:
Hi,

As far as I know, the number of threads in the thread pool cannot be set at
run time and is governed by a setting in the machine.config file.

**** You can change the values at run time through COM interop, just call ICorThreadPool::CorSetMaxThreads (see mscoree.h).
The machine.config file threadpool values are only used by the asp.net host.

Willy.
 
Back
Top