Click here to Skip to main content
15,881,709 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: Multithreaded code is ridiculous Pin
CodeWraith15-Jul-20 12:04
CodeWraith15-Jul-20 12:04 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 12:34
mvahoney the codewitch15-Jul-20 12:34 
GeneralRe: Multithreaded code is ridiculous Pin
CodeWraith15-Jul-20 12:47
CodeWraith15-Jul-20 12:47 
GeneralRe: Multithreaded code is ridiculous Pin
PIEBALDconsult15-Jul-20 14:17
mvePIEBALDconsult15-Jul-20 14:17 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 14:18
mvahoney the codewitch15-Jul-20 14:18 
GeneralRe: Multithreaded code is ridiculous Pin
PIEBALDconsult15-Jul-20 14:44
mvePIEBALDconsult15-Jul-20 14:44 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 15:53
mvahoney the codewitch15-Jul-20 15:53 
GeneralRe: Multithreaded code is ridiculous Pin
Mircea Neacsu15-Jul-20 16:30
Mircea Neacsu15-Jul-20 16:30 
Quote:
o as an instructional article I'm preparing code that can enqueue work items to a limited number of threads. If all the threads are busy and there's no more thread creation allowed (say you have a 3 thread limit) then one of the threads that's already busy enqueues the next message for when it's done with what it's currently processing. It schedules among the already busy threads using a round robin technique.

It's called a producer-consumer model and it's generally not so hard to handle. In most cases you need just one queue and all consumers feed from it. No rule that says a consumer cannot be a producer also. Consumers need to be polivalent meaning they know how handle any task that they pick from the queue.

If you have task-oriented consumers that know how to do only one task (sometimes called fussy-eaters) you're beter off with multiple queues and and each consumer waits in the appropriate queue.
Mircea

GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 22:19
mvahoney the codewitch15-Jul-20 22:19 
GeneralRe: Multithreaded code is ridiculous Pin
RickZeeland15-Jul-20 19:42
mveRickZeeland15-Jul-20 19:42 
GeneralRe: Multithreaded code is ridiculous Pin
Rick York15-Jul-20 22:06
mveRick York15-Jul-20 22:06 
GeneralRe: Multithreaded code is ridiculous Pin
Nelek15-Jul-20 22:19
protectorNelek15-Jul-20 22:19 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 22:28
mvahoney the codewitch15-Jul-20 22:28 
GeneralRe: Multithreaded code is ridiculous Pin
Nelek15-Jul-20 23:30
protectorNelek15-Jul-20 23:30 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch16-Jul-20 4:08
mvahoney the codewitch16-Jul-20 4:08 
GeneralRe: Multithreaded code is ridiculous Pin
F-ES Sitecore16-Jul-20 1:04
professionalF-ES Sitecore16-Jul-20 1:04 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch16-Jul-20 4:07
mvahoney the codewitch16-Jul-20 4:07 
GeneralRe: Multithreaded code is ridiculous Pin
F-ES Sitecore16-Jul-20 5:08
professionalF-ES Sitecore16-Jul-20 5:08 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch16-Jul-20 5:22
mvahoney the codewitch16-Jul-20 5:22 
GeneralRe: Multithreaded code is ridiculous Pin
Gerry Schmitz16-Jul-20 7:03
mveGerry Schmitz16-Jul-20 7:03 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch16-Jul-20 7:08
mvahoney the codewitch16-Jul-20 7:08 
GeneralRe: Multithreaded code is ridiculous Pin
Gerry Schmitz16-Jul-20 11:36
mveGerry Schmitz16-Jul-20 11:36 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch16-Jul-20 11:52
mvahoney the codewitch16-Jul-20 11:52 
GeneralRe: Multithreaded code is ridiculous Pin
Gerry Schmitz16-Jul-20 12:27
mveGerry Schmitz16-Jul-20 12:27 
GeneralRe: Multithreaded code is ridiculous Pin
maze317-Jul-20 0:59
professionalmaze317-Jul-20 0:59 

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.