Hacker News new | past | comments | ask | show | jobs | submit login

Switching stacks isn’t the difficult part, it’s the related stack memory management.



Could you explain more and elaborate?

The previous coroutine state needs to be recovered onto the stack and registers for the coroutine to function correctly from its previous point. Temporal memoizes API calls and replays the same function deterministically, so it doesn't attempt to jump into half way into a function, that a coroutine could do.


Switching stacks is just longjmp().

Memory management for stacks has tricky questions about how much address space to reserve for each stack and how to ensure there are guard pages to catch stack overflows.

Or you can YOLO it https://dotat.at/@/2010-01-22-coroutines-in-less-than-20-lin...




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

Search: