Introduction
coproc provides building blocks for running stateful, concurrent, and specialized worker processes that require back-and-forth communication. The name comes from the combination of "cooperative" and "process" - coproc makes it easier to create specialized processes that cooperate to solve a single task.
Design
- 
In coproc, we refer to the main process of a Python script as the host, and any daeomon processes it creates as worker processes.
- 
The host maintains a WorkerResourceobject which includes the child process and a pipe for transmitting information, as well as aPriorityMessengerthat manages communications across the channel.
- 
WorkerProcessexists on the worker side, and maintains the processes state and main event loop. The worker process also includes aPriorityMessengerthat is used to communicate with the host process.
The following diagram shows how the host and worker work together: they each maintain PriorityMessenger objects that support multi-channel priority messaging designs.