News for hackers. Stuff that matters.
Re:Why Wasn't Ruby 3 Faster? by otabdeveloper4 on Thursday February 11, 2021 @02:01AM (#26099003)
> threads are lighter weight than processes, they're still relatively expensive to switch between and to maintain in memory compared to e.g. Go/Elixir lightweight threads or evented IO

Not true. Context switching pthreads is orders of magnitude faster than any Go/Elixir concurrency mechanism.

So-called "lightweight" threads exist to fix the concurrency problem with garbage collection in scripting languages. Without garbage collection pthreads are fast enough for any problem.

Re:Why Wasn't Ruby 3 Faster? by ramchip on Thursday February 11, 2021 @07:56AM (#26100972)
Lightweight threads in Erlang/Elixir were created as a unit of fault tolerance. A lightweight thread can suddenly exit when it hits an error, and the VM mechanisms give you guarantees that any resource it owned will be freed (memory, sockets, registered name, ETS tables, etc.) Using signals and monitors you can extend this to any other type of resources, for instance DB connections in an SQL adapter library.

That's the original advantage over OS threads.

Re:Why Wasn't Ruby 3 Faster? by otabdeveloper4 on Thursday February 11, 2021 @09:06AM (#26101606)
No, you don't need cooperative threads for this. Proper exception handling fixes this problem with OS threads for you.