

Sched_rt_entity is implemented in /include/linux/sched.h. virtual void update(): update timeSliceables or Sliceable depending on geom. Like CFS, the RT scheduler has its own scheduling entity and runqueue data structure which are added as members to task_struct and the main runqueue. This indicates to the rest of the kernel that schedule should be called. If so, it sets a (over-simplification alert) per-cpu flag called needresched. In schedulertick, the scheduler checks to see if the running process’s time has expired. It, however, started a discussion among kernel developers and its future is not entirely set. Notice how updateprocesstimes invokes schedulertick. When we process this through the bapi this results in the following two timeslices on the installation fact: One time slice from May 1st, 2003 to June 30th, 2004 A second (not wanted) timeslice from July 1st, 2004 to December 31st, 9999. This is supposed to add more security to the kernel against blocking FIFO tasks. The goal is to set the enddate to June 30, 2004. They assign an RT task group with FIFO tasks a certain bandwith for a processor (95% by default) before they are pre-empted if they want to or not.

Occasionally, you can see throttling or bandwith operations in the RT scheduler implementation.These were added to add some safety to SCHED_FIFO tasks. That way,operations like adding, removing or finding task with highest priority can be achieved in O(1) time. It uses multiple runqueues where one is reserved for each priority. With its priority implementation, the RT class follows the same concept, the previous O(1) scheduler did.

It can also be pre-empted by tasks with higher priority before the time slice is over. That means, as soon as the task's time slice is over, it is set to the end of the queue and its slice is refilled. SCHED_RR: An RR task will be scheduled for a fixed time slice and then pre-empted in a round robin fashion by tasks with the same priority.SCHED_FIFO: A scheduled FIFO task has no time slice and will be scheduled until it terminates,yields the processor voluntarily or a higher priority task becomes runnable.Tasks handled by the RT scheduler can be configured in two different scheduling modes: The corresponding scheduling class is rt_sched_class which is implemented in kernel/sched_rt.c. If not, the RR task's timeslice is reduced by one. Then the function returns if current is a FIFO task. It is pretty straight forward: In the beginning runtime statistics of the current task and its runqueue are updated in updatecurrrt (). However, while the kernel is usually capable of meeting very strict RT scheduling deadlines, it does not guarantee that deadlines will be met. schedulertick () calls tasktickrt () to update the current task's time slice. This means that is can effectively schedule tasks that have strict timing requirements. The Linux scheduler supports soft real-time (RT) scheduling.
