Live data from Hacker News

Durable Coroutines for Go

github.com

1–10 of 37 posts

Re: Durable Coroutines for Go

#4
Impressive work. This reminds me of an experimental JVM that was around about 20 years ago from a group called Velare. They could do durable coroutines just like this, but by throwing a particular exception rather than using `yield`. They also could return a value and allow the coro to be resumed with a value.

edit: here it is https://dl.acm.org/doi/10.1145/949344.949362 It was a built-in bytecode interpreter with suspendable threads

It changed significantly how you think about cooperating processes. It was like watching 2 processes have a conversation with each other without the controlling code getting involved in any way. Also, if you save the coros after each call, you can get step-by-step replays which are very helpful in debugging.

Re: Durable Coroutines for Go

#6

Why are channels insufficient for this use case?

A goroutine-and-channel implementation may not work as well for the "durable" goal, while this implementation is focused on being able to perfectly serialize the state of the Coroutines in order to resume them elsewhere (durable).

Re: Durable Coroutines for Go

#8
post #5

This seems really brittle. https://github.com/stealthrocket/coroutine/blob/main/getg_am...

Why?

It's hardcoding an implementation detail of the Go runtime, which is subject to change (and if it did, this library might have non-obvious failure behaviour).

Re: Durable Coroutines for Go

#10
nice, but i had a separate idea.

what if u build a wasm runtime that can save and restore memory with and execution states, sounds much more full proof. or i might have misunderstood this idea :D.

Post reply on HN