3.4 Control and Organisation of the Tasks
Another important aspect of the multi-process architecture of the UCL facsimile system, is the need to systematise the control and organisation of the tasks. This activity is the function of the task controller, whose operations are discussed in this section.
3.4.1 Command Language
As mentioned earlier, the task controller supports a procedure-oriented language by means of which the user or the routines of the upper layers can define the jobs requested. A command should contain the following information:
- the names of the task processes which are involved in the job.
- the open parameters for these task processes.
- the order in which the tasks are to be linked.
The last item is quite important, though, usually, the same order as that given in the command is used.
A command in this language is presented as a zero- ended character string. In the task name strings and the attribute strings of the open parameters, '|', '"', and ',' must be excluded as they will be treated as separators. The definition is shown below, where '|', which is the separator of the command strings in the language, does not mean 'OR'.
<command_string> ::= <task_string>
<command_string> ::= <task_string>|<command_string>
<task_string> ::= <task_name>
<task_string> ::= <task_name>"<open_parameter>
<open_parameter> ::= <attribute>
<open_parameter> ::= <attribute>,<open_parameter>
3.4.2 Task Controller
In our experimental work, the task controller module is called fitter. This name which is borrowed from UNIX hints how the module works. According to the command string, it links the specified tasks into a chain, along which the data is processed to fulfil the job requested (Fig. 8).
tasks
+-----+ +-----+ +-----+
! a ! -> ! b ! -> ! c !
+-----+ +-----+ +-----+
Fig. 8 The task chain
Since all modules, including fitter itself, are implemented as processes, the connections between modules should be via the Clean and Simple interfaces. Upon receiving the command string, the fitter parses the string to find each task process involved and opens a connection to it. Formally, the task processes are chained directly, but, logically, there is no direct connection between them. All of them are connected to the fitter (Fig. 9).
fitter
+-------------+
+-- ! ! --+
| +-------------+ |
| | |
V V V
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
Fig. 9 The connection initiated by the fitter
For each of the processes it connects, the fitter keeps a table called pipe. When the command string is parsed, the pipe tables are double-linked to represent the specified order of data flow. So far as one process is concerned, its pipe table contains two pointers: a forward one pointing to its destination and a backward one pointing to its sources. Besides the pointers, it also maintains the information to identify the task process and the corresponding connection.
Fig. 10 illustrates the chain of the pipe tables for the job "a|b|c". Note that the forward (output) chain ends at the sink, while the backward (input) chain ends at the source. In this sense, the task processes are chained in the specified order via the fitter (Fig. 11). The data transfer along the chain is initiated and controlled by the fitter, each process getting the input from its source and putting the output to its destination.
+-----+ +-----+ +-----+
! * -+--> ! * -+--> ! 0 !
+-----+ +-----+ +-----+
! 0 ! <--+- * ! <--+- * !
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
! ! ! ! ! !
! ! ! ! ! !
+-----+ +-----+ +-----+
Fig. 10 The pipe chain
fitter
+-------------+
+-> ! * -> * -> * ! --+
| +-------------+ |
| | A |
| V | V
+-----+ +-----+ +-----+
! a ! ! b ! ! c !
+-----+ +-----+ +-----+
Fig. 11 The data flow
This strategy makes the task organisation so flexible that only the links have to be changed when a new task chain is to be built up. In such an environment, each task process can be implemented independently, provided the Clean and Simple interface is supported. This also makes the system extension quite easy.
The fitter manipulates one job at a time. But it must maintain a command queue to cope with the requests, which come simultaneously from either the upper level processes or other hosts on the network.