Click here to Skip to main content
15,884,176 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: Comet NEOWISE Pin
OriginalGriff15-Jul-20 22:32
mveOriginalGriff15-Jul-20 22:32 
GeneralRe: Comet NEOWISE Pin
Nelek15-Jul-20 23:31
protectorNelek15-Jul-20 23:31 
GeneralRe: Comet NEOWISE Pin
5teveH15-Jul-20 22:31
5teveH15-Jul-20 22:31 
GeneralRe: Comet NEOWISE Pin
jsc4216-Jul-20 0:19
professionaljsc4216-Jul-20 0:19 
GeneralRe: Comet NEOWISE Pin
Daniel Pfeffer16-Jul-20 1:04
professionalDaniel Pfeffer16-Jul-20 1:04 
GeneralRe: Comet NEOWISE Pin
5teveH16-Jul-20 1:59
5teveH16-Jul-20 1:59 
GeneralRe: Comet NEOWISE Pin
jsc4217-Jul-20 0:13
professionaljsc4217-Jul-20 0:13 
RantMultithreaded code is ridiculous PinPopular
honey the codewitch15-Jul-20 10:45
mvahoney the codewitch15-Jul-20 10:45 
So 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.

The whole thing works using message passing and message queues. That's how the threads communicate with each other. You can post messages to each of the threads.

The trouble with it is the complexity of it snowballs. All of the sudden I need to sync the UI which requires a whole separate layer. And then there's the interthread communication that's already complicated.

There's only so much I can fit into an article without overwhelming the reader, and to produce anything approaching a real world example requires so much complicated code that it's just silly.

Oh you did this over here? Well you need to synchronize over there. And because you did that, you need to handle it over there too, etc. It's a mess.

I really think the approach traditional computers take to preemptive multithreading is an anti-pattern. It feels like every anti-pattern I've ever encountered: The more code you need to make it work, the more code you need to make it work! You end up putting more work into it just to get to the point where you can put more work into it, and everything feels like a workaround.
Real programmers use butterflies

GeneralRe: Multithreaded code is ridiculous PinPopular
Greg Utas15-Jul-20 11:05
professionalGreg Utas15-Jul-20 11:05 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 11:47
mvahoney the codewitch15-Jul-20 11:47 
GeneralRe: Multithreaded code is ridiculous Pin
Greg Utas15-Jul-20 12:22
professionalGreg Utas15-Jul-20 12:22 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 12:36
mvahoney the codewitch15-Jul-20 12:36 
GeneralRe: Multithreaded code is ridiculous Pin
Greg Utas15-Jul-20 12:58
professionalGreg Utas15-Jul-20 12:58 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 13:16
mvahoney the codewitch15-Jul-20 13:16 
GeneralRe: Multithreaded code is ridiculous Pin
raddevus15-Jul-20 17:29
mvaraddevus15-Jul-20 17:29 
GeneralRe: Multithreaded code is ridiculous Pin
Member 1330167916-Jul-20 20:19
Member 1330167916-Jul-20 20:19 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch17-Jul-20 2:09
mvahoney the codewitch17-Jul-20 2:09 
GeneralRe: Multithreaded code is ridiculous Pin
Member 1330167917-Jul-20 6:28
Member 1330167917-Jul-20 6:28 
GeneralRe: Multithreaded code is ridiculous Pin
achillepaoloni18-Jul-20 7:23
achillepaoloni18-Jul-20 7:23 
GeneralRe: Multithreaded code is ridiculous Pin
raddevus15-Jul-20 17:34
mvaraddevus15-Jul-20 17:34 
GeneralRe: Multithreaded code is ridiculous Pin
Nelek15-Jul-20 22:16
protectorNelek15-Jul-20 22:16 
GeneralRe: Multithreaded code is ridiculous Pin
raddevus16-Jul-20 3:05
mvaraddevus16-Jul-20 3:05 
GeneralRe: Multithreaded code is ridiculous Pin
Greg Utas16-Jul-20 0:37
professionalGreg Utas16-Jul-20 0:37 
GeneralRe: Multithreaded code is ridiculous Pin
CodeWraith15-Jul-20 11:06
CodeWraith15-Jul-20 11:06 
GeneralRe: Multithreaded code is ridiculous Pin
honey the codewitch15-Jul-20 11:56
mvahoney the codewitch15-Jul-20 11:56 

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.