Max number of kernel mode threads

Hi,

Is there any limitation on number of kernel mode threads in a driver.

I need to implement a decoding logic in which around worst case
situation of 256(Very rare case) independent threads would be required.

Thanks,


Play 100s of games for FREE! http://games.mail.com/

>I need to implement a decoding logic in which around worst case

situation of 256(Very rare case) independent threads would be required.

What is the need of this? they will compete for the same CPUs and starve one
another.

Is it not a good idea to have a thread per CPU?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi Maxim,

Thanks for your response.

would be so kind of you if you can brief me on “thread per cpu”. I am not able to get this.? what’s the way to implement this.

Thanks

First, there is no defined limit on the number of kernel threads you can
start. (Well there is a defined limit, but it is probably MAX_INT or
some similar constraint.) However 256 threads is a lot of threads and
each one consumes resources.

Maxim is suggesting that as no more than N-cpu threads can be
concurrently executing that perhaps you should consider a design that
used a small pool of worker threads, where small is some multiple of the
number of CPUs on the system, and have each of those threads process
tasks for your 256 independent work streams. The OS provides a similar
facility through its generic IO_WORKITEM mechanism, and it is fairly
trivial to create your own private pool of threads that perform tasks on
request. I believe that there is an NtInsider article from a while ago
that described just such a mechanism.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@techie.com
Sent: Tuesday, August 29, 2006 7:45 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Max number of kernel mode threads

Hi Maxim,

Thanks for your response.

would be so kind of you if you can brief me on “thread per cpu”. I am
not able to get this.? what’s the way to implement this.

Thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

>but it is probably MAX_INT or some similar constraint

The limit is defined by the number of physical pages, because each thread
needs some number of nonpaged memory.


Slava Imameyev, xxxxx@hotmail.com

“Roddy, Mark” wrote in message news:xxxxx@ntdev…
First, there is no defined limit on the number of kernel threads you can
start. (Well there is a defined limit, but it is probably MAX_INT or
some similar constraint.) However 256 threads is a lot of threads and
each one consumes resources.

Maxim is suggesting that as no more than N-cpu threads can be
concurrently executing that perhaps you should consider a design that
used a small pool of worker threads, where small is some multiple of the
number of CPUs on the system, and have each of those threads process
tasks for your 256 independent work streams. The OS provides a similar
facility through its generic IO_WORKITEM mechanism, and it is fairly
trivial to create your own private pool of threads that perform tasks on
request. I believe that there is an NtInsider article from a while ago
that described just such a mechanism.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@techie.com
Sent: Tuesday, August 29, 2006 7:45 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Max number of kernel mode threads

Hi Maxim,

Thanks for your response.

would be so kind of you if you can brief me on “thread per cpu”. I am
not able to get this.? what’s the way to implement this.

Thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer