Interfacing with its environment
Designing a task requires that the key interfaces with its environement be very well defined.
This includes:
- Synchronisation with other tasks
- Memory mapping for the entire system
- All dependencies with other tasks and external I/O
- Execution model (how the system decides which tasks can run at which times)
- Make sure all the message parameters and timer values have been finalized.
Task states
Once the external interfaces are defined, select the internal logic of the task states.
Task Design Guidelines
- As when choosing the number of tasks for the system, there should be a correct number of task states.
Each task tate should be able to have a simple definition
that can be stated simply in a few words.
- Too many states will needlessly complicate the system, and make it difficult to understand.
- Too few states will make some states needlessly complex, by adding flags and variables to represent the missing state information.
- Data structures should be simple and clearly defined - exactly tailored for their job.
- As is the case for the overall system, key characteristics of task execution, such as performance, real-time constraints, power management, should be taken into account from the very start of the task design.
- All possible task situations (eg: out of memory conditions) should be taken into account, from the start.
- Be sure to manage resources properly, deallocating at the end of the task execution - including when handling errors.