|
Declaring Tasks |
Top Previous Next |
|
This time, we shall need a TASK statement for each of the two tasks in the application. In general, a configuration file must contain a TASK statement for each concurrently executing task in the system:
task driver ins=1 outs=1 data=? task upc ins=1 outs=1 data=20k
As well as the task's name, the TASK statement must specify the number of input ports and output ports it has. We saw in The Diamond Model that a task has a vector of input ports and a vector of output ports that are used to communicate with other tasks. In our example, as we can see from the diagram, the driver and upc tasks each have one input and one output port, which they use for communicating with each other; the connection to the host is managed separately. The INS and OUTS attributes of the TASK statements define this. Note that the ports are numbered from 0 upwards.
As we have seen, the TASK statement also includes attributes that specify what strategy the configurer should use for allocating memory to the task. Here we are using the DATA attribute, which results in the stack and heap data areas sharing a single area of memory. In the upc task, we specify that this area should be 20K (20,480) octets in size. The driver task, which has the data=? attribute we have seen before, will get the largest free memory area remaining once upc's requirements have been fulfilled. Only one task on each processor can have its memory requirements left unspecified in this way. The configurer would otherwise have to decide how to split the remaining memory between several tasks with unspecified requirements. Because an even split is unlikely to be desirable in practice, the configurer refuses to make the decision for you. Memory Use gives hints on estimating memory requirements when multiple tasks must be placed on the same processor. If in doubt, overestimate. |