Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

The problem with this is you only get 1 thread for the UI and other stuff to run on.


sort by: page size:

But there's only one GUI thread. It wouldn't work.

The whole damn thing just uses only one thread for UI, how is that smooth?

That's not really a good thing, though. You don't need "a thread per window" especially w/ modern async computation, you just need the UI to be in a separate thread from anything that might keep the CPU busy to begin with.

Why would you want multiple threads touching the UI? Android processes for instance only have one UI thread.

You can't do work on the UI thread, it'll block the UI! With only half a /s

You don't need a multi-threaded GUI for that. You can have the GUI running on one thread while the task runs on another.

It's probably a very old decision, from times when most desktop computers had one CPU and threads were mostly used to keep GUI responsive while the application was churning data in the background, so there was little interaction between them.

So the entire dev environment and any programs you have running in it only uses a single thread?

Can you clarify what you mean? You seem to imply that using multiple threads is not a good idea, but then also express that not using multiple threads is also not a good idea. What's left?

I don't get you. Are you saying that the only reason people would want threading capabilities is to exploit multicore/multiprocessor architectures?

That isn't true. Having multiple threads for GUI applications makes sense for responsiveness even on a single-core machine.


There can be many threads per process, but plenty of applications ("Generally") are still single-threaded or even if they aren't, they only use one for the UI.

You can't create 1M threads on Windows (or OS X, for that matter) because there won't be enough RAM for stack space. (also, running more threads than physical cores on CPU-bound task is pretty pointless).

Maybe you mean we should schedule something which has a complete event loop? That would be a lot more fair wrt the Akka version, but the Go version does not create any threads either.


OK, but surely there are cases where it would be useful (I would argue necessary) to have a single process with multiple threads - when dealing with GUIs for example.

totally. but biggest problem is it's still single-threaded and an errant program can still lock the whole thing up

and i understand this is extremely difficult to fix


They should make it multi threaded, I am seeing so many places in which UI is blocked and unresponsive while waiting for I/O or other logic.

Ah that might be able to help bridge the gap for me. I still don’t quite follow, but I guess having multiple threads allows for easier testing of the interface with other components, perhaps? Sorry I am out of my depth on this one. Will Google more tonight

Performance of UI is mostly single threaded

Expanding on this, if you do all the work on the main thread, you're implementing a cooperative multitasking system, with all of the problems that entails.

It's surprisingly hard to break up potentially long tasks in an ergonomic way without losing a ton of performance, tracking down a long tail of tasks that block rendering, or both. Having multiple threads of execution is so much better.


But then you get into a whole heap of problems with multiple threads.
next

Legal | privacy