391
you are viewing a single comment's thread
view the rest of the comments
[-] pixxelkick@lemmy.world 6 points 2 years ago* (last edited 2 years ago)

ITT: non devs that think multithreading is still difficult.

It's become so trivial in many frameworks/languages nowadays, its starting to actually shifting towards single threading being something you have to do intentionally.

Everything is async by default first class and you have to go out of your way to unparallelize it.

It's being awhile since I have seen anything mainstream that seriously cared about single thread performance enough to make it the most important benchmark.

I care about TDP way more. Your single thread performance doesn't mean shit if your cpu starts to thermal throttle.

[-] qqq@lemmy.world 55 points 2 years ago* (last edited 2 years ago)

Async features in almost all popular languages are a single thread running an event loop (Go being an exception there I believe). Multi threading is still quite difficult to get right if the task isn't trivially parallelizable.

[-] vext01@lemmy.sdf.org 9 points 2 years ago

Exactly.

Also every time I've used async stuff, I've pined for proper threads. Continuation spaghetti isn't my bag.

[-] kunaltyagi@programming.dev 3 points 2 years ago

Which language? Usually there's a thread pool where multiple tasks are run in parallel. CPython is a special case due to gil, but we have pypy which has actual parallelism

[-] vext01@lemmy.sdf.org 1 points 2 years ago

I've only ever used it in those lua microcontrollers and in Rust with the async keyword.

In lua I doubt they use proper threading due to the GIL. Rust probably can do async with threads, but it just wasn't fun to work with.

[-] kunaltyagi@programming.dev 1 points 2 years ago

Tokio has support for multiple threaded async in rust. As for micro controller, I don't think you can have multiple threads in flight anyways, so that's the best you'll get

[-] mihies@kbin.social 7 points 2 years ago

Wait, wat? Looking at first sentence. Also async != multi threading.

[-] GnomeKat 3 points 2 years ago

My goto for easy multi threading is lock free queues. Generate work on one thread and queue it up for another thread to process. Easy message passing and stuff like that. It doesn't solve everything but it can do a lot if you are creative with them. As long as you maintain a single thread ownership of memory and just pass it around the threads via message passing on queues, everything just sorta works out.

[-] CrayonRosary@lemmy.world 2 points 2 years ago

Don't use goto.

[-] brian@programming.dev 3 points 2 years ago

A lot of languages have an asunc/await facade for tasks run on a background thread for result (c#, clj, py, etc), but it's certainly not the default anywhere, and go most goroutines(?)/other csp implementations are probably going to be yielding for some io most of the time at the bottom anyway

[-] qqq@lemmy.world 1 points 2 years ago

Yes I'm mostly familiar with this in Kotlin. Sometimes this is kinda a footgun because you're writing multi threaded code without explicitly doing so.

[-] sndrtj@feddit.nl 23 points 2 years ago

Concurrent is not the same as parallel.

[-] QuaternionsRock@lemmy.world 1 points 2 years ago

But concurrent execution is multithreaded. “unparallelize” is the only misnomer in the comment you replied to. Asynchronous execution is not necessarily concurrent, but often is.

However, a high TDP does not inherently mean that thermal throttling will occur, and there are countless everyday processes that are inherently sequential (“single-threaded”), so I still disagree with the comment on most counts.

[-] throwwyacc@lemmy.world 5 points 2 years ago

I'm a software engineer. And yes multithreading is difficult, just slapping on async isn't necessarily going to help you run code in parallel

Think about the workload a game is using, you have to do most calcs on a frame by frame basis and you tend to want effects to apply in order. So you have a hard time running in parallel as the state for frame 1 needs to be calculated before frame 2. And within frame 1 any number of scripts can rely on the results of another, so you can't just throw threads at the problem You can do some things like the sound system but beyond that it's not trivial

[-] vrighter@discuss.tchncs.de 1 points 2 years ago

as a dev, seeing you conflate "async" with "multithreaded" is painful.

And what you're saying is just not true anyway.

this post was submitted on 02 Jan 2024
391 points (100.0% liked)

Technology

72319 readers
2788 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related news or articles.
  3. Be excellent to each other!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, this includes using AI responses and summaries. To ask if your bot can be added please contact a mod.
  9. Check for duplicates before posting, duplicates may be removed
  10. Accounts 7 days and younger will have their posts automatically removed.

Approved Bots


founded 2 years ago
MODERATORS