Description
Algorithms
The Scheduling Algorithms are:
- DM
- Deadline Monotonic. The tasks having lesser deadlines have highest priorities.
- RM
- Rate Monotonic. The tasks having lesser periods have highest priorities.
- EDF
- Earliest Deadline First. The task having its deadline before the other ones is executed first (actually, the "plus" function is not applied here, all tasks having to be scheduled in parallel).
- Audsley++
- All combinations of possible priorities are checked. For n tasks, there are factorial n possible priority orders.
Constraints
One of the possible constraints of a given scenario is the preemption cost: if a task is preempted (i.e. has to suspend its execution due to other tasks or contraints), a certain number of time units are added when the task restarts, representing the processor cost due to the preemption (typically the context switching).
Other constraints include:
- precedence
- strict periodicity
- non preemptiveness
- latency
Command
The main command is taskadd. It takes the scenario as parameter, either in a file or in a string.
Usage: taskadd [options] filename-or-string -a <algo> Set algorithm (dm, rm, edf) -c Colour display (recommended if your terminal accepts it) -l Long: complete display of result even if very long -q Quiet: no output; exit 0 if schedulable, 1 if not -s Argument is string instead of input file name -v Display current version and exit -help Display this list of options
The result is the displaying of the scheduled scenario, step by step, the tasks being displayed according to their number (the first one being "1") and in colour if option "-c" is used. The times units corresponding to preemption costs are displayed in reverse video if option "-c" is used (otherwise they are between parentheses).
It is followed by the displaying of the FRT (First Response Time) and the WRT (Worst Response Time).
The exit status of the command can be:
- 0: the scenario is schedulable
- 1: the scenario is not schedulable
- 2: a syntax error occurred
The "-a" (algorithm) option can be used to select an algorithm, which can be "dm", "rm" or "edf". The default is "dm".
If the "-q" (quiet) option is provided, the scheduled scenario is not displayed.
If the "-s" option is provided, the scenario is described in the command line (it is no more a file name) with the same syntax (see below) where newlines can be replaced by slashes ("/").
Syntax
A taskadd file can contain several scenarios separated by a line containing "EOD".
A scenario contains the description of all tasks with the possible constraints they have.
The first line contains the global cost of the preemption. If no cost, its value must be 0.
Each of the following lines contain tasks descriptions, one task by line.
After the tasks descriptions, there are possible scenario constraints.
Task description
A task description is one line containing:
- release time: a positive or negative integer.
- duration: a non-zero positive integer.
- deadline (optional): a non-zero positive integer.
- period: a non-zero positive integer.
If the deadline is not present, its value is equal to the value of the period.
This line can be completed by specific task constraints:
- the optional keyword "np" if the task is non preemptive.
- the optional keyword "pc" followed by a positive integer if the task has a specific preemption cost.
Scenario constraints
If there is a line only containing the keyword "prec", the scenario has a global precedence constraint, i.e. each task release is set to be just after the end of the first instance of the previous task (according to their priorities). In that case, the defined release times of the tasks descriptions are ignored.
If there is a line containing the keyword "prec" followed by a colon ":" and precedence constraints, this defines specific precedence constraints for some tasks. A precedence constraint says that the first instance of some task must be executed before the release some another task. The syntax is:
precedence-constraint ::= task-name less-tasks less-tasks ::= non empty list of less-tasks less-task ::= "<" task-name task-name ::= "t" integer
For example:
prec: t1<t4 t2<t7<t5
If there is a line only containing the keyword "strp", the scenario follows the strict periodicity constraint, i.e. each task must start at the beginning of their period.
If there is a line only containing the keyword "fnp", all tasks are non preemptive. This is equivalent to the keyword "np" (see "Task description" above) set to all tasks.
If there is a starting with the keyword "lat" and a colon : and latency constraints, this defines latency constraints for some tasks. A latency constraint says that the distance (number of time units) between the end of some instance of some task and the beginning of some other instance of some other task must be less that a specified value. This is a check done after a successful scheduling. The syntax is:
latency-constraint ::= task-instance "->" task-instance "<" integer task-instance ::= task-name "(" instance ")" task-name ::= "t" integer instance ::= integer
For example:
lat: t1(6)->t4(3)<53 t3(12)->t4(3)<36
Example
A test file:
$ cat test.dm 2 0 2 8 1 1 6 24 1 4
Execution:
$ taskadd test.dm t1: rel 0 dur 2 dea 8 per 8 t1: {11......} (rel 0) t2: rel 1 dur 1 dea 6 per 6 t2: {2.....} (rel 1) t3: rel 24 dur 1 dea 4 per 4 t3: {3...} (rel 24) tasks priorities: t3 t2 t1 t3 = {3...} (rel 24) t3 ⊕ t2 = 2.....2.....2.....2.{...32..3..23} (rel 1) t3 ⊕ t2 ⊕ t1 = 12(1)(1)1..211...2..11.2.{...32113..2311.32..31123} (rel 0) r = 12(1)(1)1..211...2..11.2.{...32113..2311.32..31123} (rel 0) FRT 5 1 1 WRT 5 1 1
Short version (option "-q"):
$ taskadd -q test.dm FRT 5 1 1 WRT 5 1 1
Short version and scenario in a string:
$ ./taskadd -q -s "2/0 2 8/1 1 6/24 1 4" FRT 5 1 1 WRT 5 1 1
Exit status ("0" since the scenario is schedulable):
$ echo $? 0↑