Click here to Skip to main content
15,881,767 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Gotta love the drive by one star votes Pin
Brisingr Aerowing18-Jul-20 15:09
professionalBrisingr Aerowing18-Jul-20 15:09 
GeneralRe: Gotta love the drive by one star votes Pin
Garth J Lancaster18-Jul-20 20:53
professionalGarth J Lancaster18-Jul-20 20:53 
GeneralRe: Gotta love the drive by one star votes Pin
Sander Rossel18-Jul-20 22:57
professionalSander Rossel18-Jul-20 22:57 
GeneralRe: Gotta love the drive by one star votes Pin
Daniel Pfeffer18-Jul-20 23:16
professionalDaniel Pfeffer18-Jul-20 23:16 
JokeA Class Act!!! PinPopular
Sandeep Mewara18-Jul-20 3:01
mveSandeep Mewara18-Jul-20 3:01 
GeneralRe: A Class Act!!! Pin
Ron Anders18-Jul-20 8:37
Ron Anders18-Jul-20 8:37 
GeneralRe: A Class Act!!! Pin
DRHuff18-Jul-20 9:59
DRHuff18-Jul-20 9:59 
QuestionWhiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch18-Jul-20 2:41
mvahoney the codewitch18-Jul-20 2:41 
WTF | :WTF:

I recently wrote a project to demonstrate a message passing and thread pooling paradigm "in the raw" (coded manually, not using the .NET task or thread pool infrastructure) so that folks could see all the moving parts.

I wanted to make something more production ready, and to show how to do the same thing using the built in Task framework and thread pool in .NET

So I start porting the app over, and one of the things it allows you to do is get/set the number of waiting threads in the pool. Well I did that with the built in thread pool and got 2047 waiting threads back.

Sigh | :sigh:

Even the docs suggest that's obscene:
Use caution when changing the maximum number of threads in the thread pool. While your code might benefit, the changes might have an adverse effect on code libraries you use.

Setting the thread pool size too large can cause performance problems. If too many threads are executing at the same time, the task switching overhead becomes a significant factor.


Now I know that they're all sleeping, but seriously, how many kernel wait handles does a process really need to allocate?

And it makes me wonder how reliant the Task framework really is on spawning actions on other threads. I have to believe it's performance tuned, but why so high? Do they really think we need that many waiting threads?

I expect more like a few at most for most applications, and a well written app shouldn't have more CPU bound operations than there are CPU cores (or hardware threads) when possible, so why so many?

Sometimes I miss working at microsoft. I knew which team to email with questions like this.

Thanks @JSOP for pointing me to SmartThreadPool. Even Stephen Toub wrote his own implementation of a thread pool so i think maybe I'll go that route, unless the thread i just tugged - a custom TaskScheduler can let me have my cake and eat it too.
Real programmers use butterflies


modified 18-Jul-20 11:17am.

AnswerRe: Whiskey Tango Echo: On thread pooling, kernel waits and Microsoftisms Pin
OriginalGriff18-Jul-20 2:43
mveOriginalGriff18-Jul-20 2:43 
GeneralRe: Whiskey Tango Echo: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch18-Jul-20 2:45
mvahoney the codewitch18-Jul-20 2:45 
AnswerRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Greg Utas18-Jul-20 2:52
professionalGreg Utas18-Jul-20 2:52 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch18-Jul-20 3:02
mvahoney the codewitch18-Jul-20 3:02 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Rusty Bullet20-Jul-20 6:54
Rusty Bullet20-Jul-20 6:54 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch20-Jul-20 6:57
mvahoney the codewitch20-Jul-20 6:57 
AnswerRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
#realJSOP18-Jul-20 3:59
mve#realJSOP18-Jul-20 3:59 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch18-Jul-20 4:19
mvahoney the codewitch18-Jul-20 4:19 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Nelek18-Jul-20 8:34
protectorNelek18-Jul-20 8:34 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
honey the codewitch18-Jul-20 11:02
mvahoney the codewitch18-Jul-20 11:02 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Nelek18-Jul-20 12:03
protectorNelek18-Jul-20 12:03 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Greg Utas18-Jul-20 13:31
professionalGreg Utas18-Jul-20 13:31 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Nelek19-Jul-20 0:19
protectorNelek19-Jul-20 0:19 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Greg Utas19-Jul-20 0:50
professionalGreg Utas19-Jul-20 0:50 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Nelek19-Jul-20 1:07
protectorNelek19-Jul-20 1:07 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Greg Utas19-Jul-20 1:30
professionalGreg Utas19-Jul-20 1:30 
GeneralRe: Whiskey Tango Foxtrot: On thread pooling, kernel waits and Microsoftisms Pin
Nelek19-Jul-20 2:06
protectorNelek19-Jul-20 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.