3 ms·
When I think that you can see the memory of a program and the execution of instructions as a state machine just a very large one. I am trying to design a state
by samsquire 4y ago
When I think that you can see the memory of a program and the execution of instructions as a state machine just a very large one.
I am trying to design a state machine representation/notation that handles the transitions of multiple complicated objects over time and between threads and machines.
I want a good notation for state machines that is similar to EBNF.
I think rule engines become relevant when you think about complicated transitions of business processes.
I settled on this, it is inspired by prolog. It represents the state progression of an async/await thread pool and parallel state machines and forking and joining state machines.
A and B is a task variable and 1 is a thread number. The pipe symbol represents a transition from a group of states, all previous facts must match before progressing.
next_free_thread = 2
task(A) thread(1) assignment(A, 1) = running_on(A, 1) | paused(A, 1)
running_on(A, 1) thread(1) assignment(A, 1) thread_free(next_free_thread) = fork(A, B) | send_task_to_thread(B, next_free_thread) | running_on(B, 2) paused(B, 1) running_on(A, 1) | { yield(B, returnvalue) | paused(B, 2) } { await(A, B, returnvalue) | paused(A, 1) } | send_returnvalue(B, A, returnvalue)
I actually worked on a BPMN project once.
The idea of this syntax is that your code would be reactive and you would have an API to retract or publish facts. The state machine handles scheduling.
- discarded1023 4y ago> I want a good notation for state machines that is similar to EBNF. If this isn't a firm requirement, perhaps you can dig into the venerable state machine notations of yesteryear. For instance ARGOS [1] and StateCharts [2]. The latter got incorporated into UML somehow [3] IIRC. Esterel [4] is a bit mind blowing. Other people prefer dataflow, in which case Lustre [5] might be worth a look. These make a strong synchrony hypothesis which may or may not apply to your situation. But if it does you're in clover. And if you're not you can still try to use this stuff in a GALS [6] architecture. [1] https://dl.acm.org/doi/10.1016/S0096-0551%2801%2900016-9 https://dl.acm.org/doi/10.1016/S0096-0551%2801%2900016-9 (and google some more) [2] https://statecharts.dev/ https://statecharts.dev/ [3] https://en.wikipedia.org/wiki/UML_state_machine https://en.wikipedia.org/wiki/UML_state_machine [4] https://en.wikipedia.org/wiki/Esterel https://en.wikipedia.org/wiki/Esterel [5] https://en.wikipedia.org/wiki/Lustre_(programming_language) https://en.wikipedia.org/wiki/Lustre_(programming_language) [6] https://en.wikipedia.org/wiki/Globally_asynchronous_locally_synchronous https://en.wikipedia.org/wiki/Globally_asynchronous_locally_...