调度系统:linux内核的调度器类与调度器策略-小结
2015-04-24 16:22
531 查看
当前的内核支持:
4种调度器类:
目前系統中,Scheduling Class的优先级顺序为 Stop-Task
> Real-Time > Fair >
Idle-Task,开发者可以根据己的设计需求,來把所属的Task配置到不同的Scheduling
Class中.
5
种调度策略:
SCHED_OTHER the standard round-robin time-sharingpolicy;
SCHED_BATCH for "batch" style execution ofprocesses; and
SCHED_IDLE for running very low priority backgroundjobs.
For each of the above policies,param->sched_priority must be 0.
Various "real-time" policiesare also supported, for special time-
critical applications that need precisecontrol over the way in which
runnable threads are selected forexecution. For the rules governing
when a process may use these policies,see sched(7). The real-time
policies that may be specified in policyare:
SCHED_FIFO a first-in, first-out policy; and
SCHED_RR a round-robin policy.
其中前面三种策略使用的是cfs调度器类,后面两种使用rt调度器类。
4种调度器类:
idle_sched_class | 作用:每个cup的第一个pid=0线程(swapper线程),是一个静态线程。启动流程: 创建流程:SMP_init-->__cpu_up()--->Core.c@init_idle(idle, cpu); { ... idle->sched_class = &idle_sched_class;//属于idel_sched_class的rq调度模型 .... #if defined(CONFIG_SMP) sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);设置线程名称swapper #endif } Core.c (trunk\kernel\kernel\sched): sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);--->线程的名称 Init_task.h (trunk\kernel\include\linux): .comm = INIT_TASK_COMM, Init_task.h (trunk\kernel\include\linux):#define INIT_TASK_COMM "swapper" 调度类属于:idel_sched_class |
stop_sched_class | 优先级最高的线程,会中断所有其他线程,且不会被其他任务打断。 作用: 1.发生在cpu_stop_cpu_callback 进行cpu之间任务migration; 2.HOTPLUG_CPU的情况下关闭任务。 |
rt_sched_class | RT, 作用:实时线程 |
fair_sched_class | CFS(公平), 作用: 一般常规线程 |
> Real-Time > Fair >
Idle-Task,开发者可以根据己的设计需求,來把所属的Task配置到不同的Scheduling
Class中.
5
种调度策略:
策略 | 描述 | 所在的调度器类 |
SCHED_NORAML(也称SCHED_OTHER) | (最常见的策略)、sched_normal 或者 sched_other是Linux默认的调度策略,其值为0 非实时进程的调度策略,也就是分时调度策略。分时进程则通过nice和counter值决定权值,nice越小,counter越大,被调度的概率越大,也就是曾经使用了cpu最少的进程将会得到优先调 | CFS |
SCHED_BATCH | (除了不能抢占外与常规任务一样,允许任务运行更长时间,更好地使用高速缓存,适合于成批处理的工作)、用于非交互的处理器消耗型进程 | CFS |
SCHED_IDLE | (它甚至比nice 19还有弱,为了避免优先级反转使用);是在系统负载很低时使用 | CFS |
SCHED_RR | (循环调度,拥有时间片,结束后放在队列末); | RT |
SCHED_FIFO | (没有时间片,可以运行任意长的时间); | RT |
SCHED_BATCH for "batch" style execution ofprocesses; and
SCHED_IDLE for running very low priority backgroundjobs.
For each of the above policies,param->sched_priority must be 0.
Various "real-time" policiesare also supported, for special time-
critical applications that need precisecontrol over the way in which
runnable threads are selected forexecution. For the rules governing
when a process may use these policies,see sched(7). The real-time
policies that may be specified in policyare:
SCHED_FIFO a first-in, first-out policy; and
SCHED_RR a round-robin policy.
其中前面三种策略使用的是cfs调度器类,后面两种使用rt调度器类。
相关文章推荐
- linux内核调度:调度策略与调度器类-小结
- Linux内核2.6的进程调度系统介绍
- linux内核调度策略SCHED_OTHER,SCHED_FIFO和SCHED_RR
- linux系统下的磁盘调度策略
- Linux内核的三种调度策略
- Linux内核之系统调用小结
- 《Linux0.11内核完全注释》读后小结 --- 中断与系统调用
- Linux内核之进程调度知识小结
- 《Linux0.11内核完全注释》读后小结 --- 中断与系统调用
- 《Linux0.11内核完全注释》读后小结 --- 进程调度与信号
- 《Linux0.11内核完全注释》读后小结 --- 进程调度与信号
- 内核驱动之Linux系统调度
- 深入理解Linux内核个人小结10---系统调用
- 调度器简介,以及Linux的调度策略
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- 【Linux技术】嵌入式linux内核的五个子系统
- Linux下常见的系统命令小结(转)
- linux初学-内核编译以及文件系统4
- Linux 内核编程之文件系统(一)
- Linux内核启动及文件系统加载过程