top | item 22456881

(no title)

foo101 | 6 years ago

A related question if anyone knows good answers here.

What programming languages' de-facto thread implementations are not wrappers around pthreads? I think Go has its own thread implementation? Or am I mistaken?

discuss

order

pjmlp|6 years ago

Java does not specify the actual threading model, so you can get green threads (user space) or red threads (kernel threads).

The upcoming Project Loom, intends to make it so that green threads become the default (aka virtual threads on Loom), but you can still ask for kernel threads, given that is what most JVM implementations have converged into.

saagarjha|6 years ago

Right, Go uses green (userspace) threads.

daurnimator|6 years ago

zig optionally uses pthreads (depending on if you link against libc or not)

signa11|6 years ago

erlang has its own process/thread implementation with, iirc, 64b per process.

toast0|6 years ago

The docs [1] say:

> A newly spawned Erlang process uses 309 words of memory in the non-SMP emulator without HiPE support. (SMP support and HiPE support both add to this size.)

And a word is the native register size, so 4 or 8 bytes these days, so fairly small, but not 64 bytes small.

[1] http://erlang.org/doc/efficiency_guide/processes.html