Hello,
I'd like to bring to the public my exercises with event driven states machines
in nim-lang. General architecture of an application looks like this:
SM == "State Machine"
MD == "Message Dispatcher"
MQ == "Message Queue"
EC == "Event Capture"
OS == "Operating System"
SM SM SM ...
| ^^
| ||
| MD
\ ^
-> / MQ /
/
|
<--- EC (epoll, kqueue)
^
| (i/o, timers, signals, fs events etc.)
|
OS
Run
Source is [here](http://zed.karelia.ru/0/nim/edsm-05.tar.gz) (state diagrams
included, see jpeg file)
This example demonstrates:
* approach in general
* state machines hierarchy (2 level in this case, LISTENER-WORKERS)
* interaction between machines
* timers, signals, i/o (including listening TCP-socket)
I have been using this design methodology for almost 10 years for constructing
various network programs (in C) and my observation is that it is quite good way
to obtain fine grain concurrency within single thread/process and so can be
used as alternative to, say, async/await or coroutines/greenlets/fibers
Since I'm newbie (to put it lightly) in nim-lang, any critical comments are
welcome.