Communicating Sequential Processes within Python asyncio env

  1. To implement CSP, coroutines should communicate exclusively via channels (queue).
  2. Queue should support interprocess communication.
  3. Since coroutines do not share memory anymore (except of channels), they can be executed in separate python processes.
  4. It will enable real parallelism since there will be separate GIL in each python process.
  5. Ideally there should be same number of parallel loops running as the number of CPU cores 1.
  6. Distributed scheduler should be implemented to coordinate
  7. The ability to execute clones of a single coroutine should be present (e.g. if the input queue is growing faster then coroutine reads from it).
  8. One loop should be "master-loop" that marks coroutines to be executed on specific loop.
  9. For the sake of simplicity, initially just round-robin schedule policy should be implemented.
  10. Fast IPC for loops synchronization is required.

1 There's possibility to implement multi-node parallelism (as in Erlang)


References

  1. C.A.R. Hoare - Communicating Sequential Processes. Paper.
  2. python-csp: implementation of CSP on threads/processes. Code, presentation.
  3. PyCSP: paper.
  4. aioprocessing - https://github.com/dano/aioprocessing