3 ms·
> You get roughly the same architecture but without the process isolation. I think that's only true for very specific kinds of architecture which are only tang
by dwohnitmok 6y ago
> You get roughly the same architecture but without the process isolation.
I think that's only true for very specific kinds of architecture which are only tangentially related to coroutines: stateless data transformations or actor-inspired architectures. Things like shared atomic data structures or mutexes translate pretty poorly to microservice architectures (they're doable, but really painful, bug-prone, and you give up a ton of performance).
EDIT: Hmmmm... on reflection, I suppose if you think of the actual stateful set of yield and continuation operations of coroutines they are one particular possible microservice architecture, but it strikes me as a bit messy? Although I guess you can retrofit the usual set of other concurrency operators on top.
- jacquesm 6y agoIt's a hack for sure, you are essentially creating a new little operating system within one binary. But it is an architecture that works remarkably well for quite a few applications: message switches, games and so on. And it even works on architectures where you only get one thread of execution.
- dwohnitmok 6y agoAh I see, you perhaps mean a slightly more general concept of coroutines than I was thinking about? Closer to something that fits a thread-like interface on top of actual threads regardless of whether it's being done through direct yields or intermediated by some sort of scheduler? Basically the crucial point being getting concurrency without the need for actual parallelism?
- jacquesm 6y agoYes. And you can simulate that perfectly using the co-routine mechanism.