Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Related: Go-style concurrency for C, http://libmill.org/


Although note that all libmill coroutines are mapped N:1 to OS threads, while goroutines are mapped M:N to OS threads. In other words, libmill won’t let you have run 2+ coroutines simultaneously on different OS cores, but Go will allow that.


In fact, this means that writing concurrent code is easier as you don’t have to worry about synchronizing access to shared state. It also means scaling applications is straightforward, since you are forced to design for horizontal scalability from the get go (similar to deploying node.js). Ive always found it strange that Go has both channels and locks as synchronization primitives.


Scaling out is natural when you have a large number of tasks, but it's not always an option when you have one big task. Maybe you need to sort a giant collection, or hash a giant input, or multiply a couple giant matrices. Threads with shared memory can get to work on those problems easily, but separate processes can't, at least not without trying to reorganize the problem to avoid doing tons of IO.


unless you start doing blocking read/write...


Libdill IO is nonblocking and calls returns a channel. Reading from the channel yields the coroutine, similar to the await statement in some languages.


oh cool ! does that happen for read/write to non-socket fd’s as well ?


Yeah, see the file descriptors section on this page http://libdill.org/documentation.html


i did before posting here, and could not find anything that might have indicated that i.e. non-socket-fd reads end up with coroutine like semantics...


is there an iOS port you'd know of - couldn't find one




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: