Patent ID: 8370846

Claim:
A task execution device, including a processor, for executing a plurality of tasks while switching the tasks from one to another by time-sharing, wherein an allocated time is allocated for each of the plurality of tasks, the plurality of tasks includes a plurality of first tasks and a single second task, and said task execution device comprises: a cycle time storage configured to store a cycle time, which is a total of the allocated times for the plurality of tasks; a task selector, embodied by the processor, configured to select a task from the plurality of tasks according to a predetermined sequence, in which the second task follows the plurality of first tasks; a corrector, embodied by the processor, and configured to, in each cycle, when the selected task is the second task, calculate a corrected allocated time for the second task, in accordance with whether the plurality of first tasks preceding the second task have entered an execution state, so that execution of the plurality of tasks is completed within the cycle time; and a task execution controller, embodied by the processor, configured to cause the selected task to be executed so that execution of the selected task is completed within one of the allocated time and the corrected allocated time.