News for hackers. Stuff that matters.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by sgerenser on Tuesday January 28, 2020 @02:37PM (#22173235)
Not the person you were asking the question to, but I can give you tons of examples. This is particularly true in the embedded space or people who write C or C++ that doesn’t have any standard event library. Basically, threads are a lowest-common denominator way to do blocking operations without stalling everything. I’ve seen a lot of code where there’s various threads running at different intervals (low priority background thread that sleeps for 1 second then wakes up to do stuff, another thread that does nothing but blink an LED, etc.) But in reality, in most non-cpu bound workloads, using an event loop would make writing this kind of code much easier and you woulnd’t ever have to worry about mutexes, semaphores, deadlocks, etc. As a C++ programmer, using Qt (even for non-UI stuff) with its event loop is just so much easier than spinning up threads just to call a network endpoint.

That being said, threads definitely have their place and are the only real way to take advantage of all the power offered by modern multi-core CPUs (well that and multi-process but that’s not really any easier to get right). But for the basic stuff I think running 80 threads when your app is only using 5% cpu is insane (something I see a lot in the C++ code I’m exposed to).

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by chrisseaton on Tuesday January 28, 2020 @02:40PM (#22173264)
Aren't all your examples still examples of concurrency?

> way to do blocking operations without stalling everything

Switching between multiple tasks doing IO - that's concurrency isn't it?

> various threads running at different intervals (low priority background thread that sleeps for 1 second then wakes up to do stuff

Different tasks ready to run and switching between them as needed - that's concurrency again isn't it?

Not really sure what everyone else in this thread is seeing that I'm not.

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by sgerenser on Tuesday January 28, 2020 @05:14PM (#22174690)
OK, sure those are actually examples of concurrency. I was thinking of concurrency more along the lines of multiple threads of execution doing useful work at the same time, which threads are actually good at doing but these examples are not that.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by justincredible on Tuesday January 28, 2020 @03:19PM (#22173633)
The confusion might be due to everyone using concurrency to mean concurrency and/or parallelism.