Concurrency is not yet fully implemented.
Concurrency is implemented with stackful fibers scheduled by a cooperative (not preemptive) scheduler. Only one fiber can run at a time, which essentially makes Mys single core. Multi core support may be added in the future if requested.
Fibers and asynchronous IO is currently implemented using pthreads and libuv.
See the fibers example for example code.
There are two fibers that are always present; the main fiber and the
idle fiber. The main fiber calls the application entry point
main(). The idle fiber is running when no other fiber is ready to
run. It waits for IO events to occur and then reschedules to run other
The diagram below is an example of how three fibers;
idle are scheduled over time.
As it is a single core scheduler only one fiber is running at a
time. In the beginning the system is idle and the
idle fiber is
running. After a while the
shell fibers have some
work to do, and since they have higher priority than the
fiber they are scheduled. At the end the
idle fiber is running