An Image/Link below is provided (as is) to download presentation
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.Content is provided to you AS IS for your information and personal use only.Download presentation by click this link.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.During download, if you can't get a presentation, the file might be deleted by the publisher.
Introduction • The scheduler makes it possible to execute multiple programs at the same time, thus sharing the CPU with users of varying needs. • minimizing response time • maximizing overall CPU utilization
Scheduling structure • task_struct • record all status about task, like policy, state … • sched_entity • cfs scheduling node • sched_rt_entity • Real-time scheduling node • rq • per-CPU runqueue data structure • cfs_rq • CFS-related fields in a runqueue • rt_rq • Real-Time classes‘ related field in a runqueue
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
Scheduling Flow Schedule() preempt_disable Take rq and task clear_tsk_need_resched pick_next_task put_prev_task Check task state deactivate_task Check task same preempt_disable context_switch
CFS • CFS stands for "Completely Fair Scheduler," and is implemented by Ingo Molnar and merged in Linux 2.6.23. • CFS basically models an "ideal, precise multi-tasking CPU" on real hardware. • Ideal multi-tasking CPU is non-existent since we can run only a single task at once.
CFS • CFS uses a time-ordered red-black tree for each CPU. • The feature of RB-tree approach: • The red-black tree is always balanced. • The time complexities of lookup operations are logarithmic. However, non-left-most lookup is hardly ever done and the left-most node pointer is always cached. • The red-black tree is O(log n) in time for most operations. (The previous scheduler employed O(1) )