Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

100% Positive

Analyzed from 275 words in the discussion.

Trending Topics

#using#https#threads#pthreads#based#alef#libthread#libmill#select#part

Discussion (9 Comments)Read Original on HackerNews

danderschabout 6 hours ago
There is also libmill/libdill, which implements go-style coroutines using setjmp and is usable directly from C (not just as a transpilation target).

https://libmill.org/

adamrezichabout 3 hours ago
What on earth is going on when you click the Tutorial button on that website?!
fsmvabout 6 hours ago
But select statements are the most important part, and second to that is the fact that goroutines are low cost user space threads
kccqzyabout 6 hours ago
Yes exactly. The author’s design decisions only make sense if this is supposed to be a toy language. On using pthreads rather than fibers:

> I decided not to use one. I wanted something dead simple — an approach I could explain in a paragraph, using tools every C programmer already knows. The trade-off is that you lose some performance with fine-grained blocking, but in many real-world situations, pthreads work fine if you use a worker pool.

Sure. You can take a large production Go app and measure how many user space threads are launched; it’s decidedly a lot more than the typical number of threads if you were using pthreads.

And the author didn’t really justify why select isn’t implemented other than implementation difficulty.

throwaway894345about 5 hours ago
I've been using Go regularly since 2012. Worker pools are completely valid and idiomatic in Go. Not sure how you read that quote and concluded "toy".
Chu4eenoabout 6 hours ago
I was expecting proper green threads (it's not like it's impossible in C, there's several C libraries for doing it).
BoingBoomTschakabout 7 hours ago
Just a small "ackchyually": Go is basically a modern Limbo which is itself based on Alef and there was an official "Alef for C" thing in Plan 9 in libthread (https://9p.io/magic/man2html/2/thread)

EDIT: looks like it was ported on UNIX as part of Plan9Port (https://github.com/9fans/plan9port/blob/master/src/libthread...)

MarkSweepabout 4 hours ago
Russ Cox created libtask, a similar library that runs on multiple UNIXes (UNIXEN?). Based on the COPYRIGHT file, it may be based on libthread.

https://swtch.com/libtask/

It’s a great little library. Very easy to read and understand.

bitwizeabout 6 hours ago
As I recall, Bell Labs actually abandoned Alef on Plan 9 because the concurrency primitives they wanted were doable in C so they just went with that.