Task scheduler behaviour in Linux

Currently, I am doing some research on Linux task scheduler behaviour. I have some questions to be clarified-

  • In the case of Multicore architecture, a scheduler thread (kernel thread) is running per core OR a central kernel scheduler is running on a dedicated core to handle all scheduling task.

  • How frequent a typical scheduler tick (interrupt) happens?, and what is a typical time-slice for a task (thread) of a particular priority ?

  • After a scheduler tick , is it mandatory to execute another task from the run-queue, even though the current task does not finish its time-slice?

  • Partial answer of the question 2 (Thanks to Dervin Thunk):

    CFS (which is default scheduler for processes) has no fixed timeslice.This timeslice always in between between sysctl_sched_min_granularity and sysctl_sched_latency (epoch length). That means the time-slice cant be less then sysctl_sched_min_granularity. The default value of these parameters are 0.75 ms and 6 ms respectively and defined in kernel/sched/fair.c.

    Along the line The CFS scheduler calculates the timeslices for a given task just before it is scheduled for execution. Its length is variable (dynamic) and depends directly on its static priority and the current load of the running queue, ie the number and priority of the tasks in the queue


    If I make assumptions about your question, I think you mean the CFS (completely fair scheduler), put in place around 2007-9. It may be easier for you to find the answer to your questions by navigating the code. (http://lxr.free-electrons.com/source/kernel/sched/fair.c), that's the fair scheduler, and (http://lxr.free-electrons.com/source/kernel/sched/sched.h) are the definitions, some of which you ask about here. Also, you may find (Understading the Linux Kernel Scheduler) interesting.


    The problem is that Linux has a lot of schedulers:

  • http://en.wikipedia.org/wiki/Brain_Fuck_Scheduler
  • http://en.wikipedia.org/wiki/Completely_Fair_Scheduler
  • http://en.wikipedia.org/wiki/O%281%29_scheduler
  • to name a few.

    链接地址: http://www.djcxy.com/p/84820.html

    上一篇: Java线程调度

    下一篇: Linux中的任务调度程序行为