主权项 |
1. A task scheduler scheduling one or more running units to execute a plurality of tasks, a total number of the plurality of tasks being greater than a total number of the one or more running units, the task scheduler comprising:
a processor, the processor is configured to
have, in a time control portion, a common time to control a state of the plurality of tasks;calculate, by a task calculator, a slack disappearance time for each of the plurality of tasks; andselect, by a running task selector, a running task having a latest slack disappearance time from among the plurality of tasks, the plurality of tasks including (i) a new task occurring when a running request newly occurs, (ii) the running task being in a running state, and (iii) a waiting task being in a waiting state, wherein an arrival time of one of the plurality of tasks is defined as T, a deadline time representing when the one of the plurality of tasks is required to be completed is defined as D, a worst case execution time predicted to be required for a completion of the one of the plurality of tasks is defined as W, a current elapsed time is defined as C, the slack disappearance time is expressed by S=T+D−W+C, a task having an earliest slack disappearance time from among the plurality of tasks is scheduled to be preferentially executed, when the slack disappearance time of the new task is earlier than the latest slack disappearance time of the running task, the new task is executed and the running task having the latest slack disappearance time switches from the running state to the waiting state, when the slack disappearance time of the new task is later than the latest slack disappearance time of the running task, the new task is in the waiting state, and the current elapsed time of the one of the plurality of tasks increases when the one of the plurality of tasks is executed. |