Related Articles

Related Articles

Generalized Real-time Task Scheduler
  • Last Updated : 14 May, 2020

Generalized Real-time Task Scheduler :
The scheduler used for handling or scheduling all the three types of real-time tasks i.e periodic, sporadic and aperiodic tasks, is known as Generalized task scheduler. It schedules periodic, sporadic and aperiodic tasks in most proficient way.

Why Generalized Task Scheduler?
Basically the cyclic scheduler is used for the accommodation of sporadic and aperiodic tasks but the arrival times of sporadic and aperiodic tasks are stated statistically. Therefore, aperiodic and sporadic tasks can not be assigned to the frames without significantly lessening the overall utilization of the system. Therefore, to schedule all the three types of tasks in a significant way, generalized task scheduler was introduced in real-time systems.
It is used to overcome the limitations of cyclic scheduler, event-driven, hybrid scheduler and all real-time task schedulers.

Working of Generalized Task Scheduler :
Generalized task scheduler initially prepares schedule for only periodic tasks i.e. time frames are assigned periodic tasks. Now sporadic and aperiodic tasks are scheduled in the slack time available in the frames after scheduling periodic tasks.
Slack time is the time left in a frame after a scheduled periodic task completed its execution. Slack time may be zero or non-zero. When the execution time of a periodic task is less than the frame size then slack time is non-zero.

Sporadic tasks can only be scheduled only if the enough slack time is available whereas in case of aperiodic tasks it is different. Sporadic tasks need to meet the deadline and in order to scheduled the sporadic tasks, acceptance test is performed to check the available slack time.
If the slack time is not enough, scheduler rejects the sporadic task. In case of aperiodic task, acceptance test is not needed. Aperiodic task does not need to meet the deadline, hence they are scheduled in available slack time.

Pseudo-code for Generalized task Scheduler :
Precomputed schedule for periodic tasks are stored in a table. It is assumed that sporadic tasks have gone through acceptance test and only eligible tasks are available.
Following is the pseudo code for generalized real-time task scheduler:

cyclic scheduler()
current-task T = Schedule-table[i];

i = i + 1;
i = i mod N;

// N is the total number of tasks
// in the schedule table


// Current task T completed early,
// sporadic tasks can be scheduled

schedule-aperiodic tasks;
// At the end, aperiodic tasks
// can be scheduled

// No task to be scheduled

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :