Comment by keithnz
1 month ago
The idea is not so much any kind of hard real time guarantee (in practice it switches quickly so it is soft realtime) but what you often have when doing bare-metal embedded systems is a lot of parallel state machines, not necessarily because the state machine is the best mechanism it's more because you want things to happen in parallel in C/C++, this can be annoying to deal with so you end up with these statemachines that don't block, you cycle through them, and you get "parallel" operation, but anything can block other statemachines, and things like long running for loops need to be broken into non blocking states. I've often thought an Actor Model like thing would be really nice if baked into the language and that the actors were all "live" such that were all processing in parallel and firing off events as needed which is how I started this. I initially was thinking switching on something like state transitions / explicit yields but every statement yielding automatically lets you run multiple "forever" loops which in turn might have long running for loops (like updating a display) statement switching means you don't have to worry about when to yield. Instead I reversed it and figured it would be nicer to define things that need to run as an atomic operation as that seems to be less frequent. This way you generally don't need to worry about blocking and it feels like it's programming as if it was pre-emptive multitasking. Multiple little programs all concurrently running and firing off events to communicate with each other
No comments yet
Contribute on Hacker News ↗