This system manages a set of processes - specifically, you can
- start
- receive output from
- request the status of
- receieve the status of
- request the termination of
- be notified of the termination of
a process. In addition, you can get request and receive a list of running processes from the manager, and ask the manager to exit as soon as all processes finish.
It is implemented using haskell threads and MVars. The manager of all the tasks runs in a thread, and each task has a thread which manages communication between the manager and the process. The message types are named after their origin and destination. Here we call the client that is using the task manager "Top":
+-----------------------+
| Top | type TopTakes = ManagerToTop
+-----------------------+
| ^
| |
TopToManager ManagerToTop
| |
v |
+-----------------------+
| Manager | data ManagerTakes = TopToManager | TaskToManager
+-----------------------+
| ^
| |
ManagerToTask TaskToManager
| |
v |
+-----------------------+
| Task N | data TaskTakes = ManagerToTask | IOToTask
+-----------------------+
| ^
(throwTo, |
terminateProcess) IOPuts
| |
v |
+-----------------------+
| IO N | type IOPuts = IOProgress | IOFinished | IOException | IOCancelled
+-----------------------+