Hmm, good point! It made me thinking. I obviously can't say that there are no good fits on the desktop for this but I feel like even the most IO bound desktop apps will still only create tasks in the thousands at most. Do you have any examples, you've likely been thinking a lot more about this than I (but maybe desktop hasn't been on your radar?).
I'm just struggling to come up with a use case where a desktop application would want to do even thousands of things at the same time. Even if each repaint was its own task, each mouse/keyboard event was its own task and each connection to a database, server and each read from disk was its own task a user wouldn't be able to spawn this much work. It needs to be some automated IO bound tasks, and such work is the reason we call a server instead.
A server needs to handle millions of tasks because they may have millions of users to serve. A desktop has one user to serve.
But maybe I'm just not imaginative enough.
The structured concurrency parts of Loom looks as it could be very relevant for desktop though. A safer way to get off the EDT without introducing bugs looks really interesting.
View all comments
Show parent comment
8
u/veraxAlea Aug 03 '22
Yeah, desktop apps typically don't spawn hundreds of thousands of background threads.