进程调度之CFS算法

以2.6.34为例,因为相对比较成熟
struct sched_entity se;//调度实体,如果在CFS调度类则在红黑树里面;
const struct sched_class *sched_class;//调度类,可以选择不同的调度算法

 

Linux CFS 进程调度算法

scheduler_tick
	=>curr->sched_class->task_tick(rq, curr, 0);//Sched_fair.c (kernel):	.task_tick		= task_tick_fair,
		=>struct sched_entity *se = &curr->se;
		=>for_each_sched_entity(se) {
			struct cfs_rq *cfs_rq = cfs_rq_of(se);
			entity_tick(cfs_rq, se, queued);
				=>update_curr(cfs_rq);//调整vruntime,vruntime是CFS调度的基本元素
					=>curr->sum_exec_runtime += delta_exec;
					schedstat_add(cfs_rq, exec_clock, delta_exec);
					delta_exec_weighted = calc_delta_fair(delta_exec, curr);

					curr->vruntime += delta_exec_weighted;
					update_min_vruntime(cfs_rq);
				=>if (cfs_rq->nr_running > 1 || !sched_feat(WAKEUP_PREEMPT))//如果是抢占内核,则需要看一下时钟中断完成之后是否需要重新选择进程调度
					check_preempt_tick(cfs_rq, curr);
		}

调整红黑树放在重新调度的地方

//调整红黑树	
try_to_wake_up
	=>cpu = select_task_rq(p, SD_BALANCE_WAKE, wake_flags);
		=>cpu = p->sched_class->select_task_rq(p, sd_flags, wake_flags);//Sched_fair.c (kernel):	.select_task_rq		= select_task_rq_fair,
			=>update_shares(tmp);
				=>walk_tg_tree(tg_nop, tg_shares_up, sd);
					=>tg_shares_up //回调函数
						=>update_group_shares_cpu(tg, i, shares, rq_weight, usd_rq_weight);
							=>__set_se_shares(tg->se[cpu], shares);
								=>struct cfs_rq *cfs_rq = se->cfs_rq;
								int on_rq;

								on_rq = se->on_rq;
								=>if (on_rq)
									dequeue_entity(cfs_rq, se, 0);

								=>se->load.weight = shares;
								se->load.inv_weight = 0;

								=>if (on_rq)
									enqueue_entity(cfs_rq, se, 0);

 

 

 

Linux CFS 进程调度算法

https://blog.csdn.net/hs794502825/article/details/10495161

 

Linux进程调度(1):CFS调度器的设计框架

https://blog.csdn.net/zhoudaxia/article/details/7375668

 

Linux内核CFS调度器

https://blog.csdn.net/u201017971/article/details/50907630

 

CFS 调度
https://blog.csdn.net/u011279649/article/details/46115807


CFS 调度器学习笔记

https://blog.csdn.net/melong100/article/details/6329201

 CFS 调度器

 http://bbs.chinaunix.net/thread-1999058-1-1.html

 

 Linux进程管理之CFS调度器分析
 https://blog.csdn.net/kevin_hcy/article/details/6064525
 
 
 Linux CFS调度器之负荷权重load_weight--Linux进程的管理与调度(二十五)
 https://blog.csdn.net/gatieme/article/details/52067665

Linux CFS调度器之虚拟时钟vruntime与调度延迟--Linux进程的管理与调度(二十六)
https://blog.csdn.net/gatieme/article/details/52067748
 
 linux的用户及权限管理
 https://blog.csdn.net/czlan91/article/details/72465730
 
 linux中进程的用户管理
 https://blog.csdn.net/lemontree1945/article/details/78645582
 
 
 linux 三种特殊权限简介 s suid sgid sticky-bit
 https://blog.csdn.net/cheungjustin/article/details/5404016
 
 Linux核心调度器之周期性调度器scheduler_tick--Linux进程的管理与调度(十八)
https://blog.csdn.net/gatieme/article/details/51872561

linux进程调度、进程切换原理详解
http://blog.chinaunix.net/uid-30126070-id-5058253.html

Linux的CFS(完全公平调度)算法
https://blog.csdn.net/liuxiaowu19911121/article/details/47070111

linux内核分析——CFS(完全公平调度算法)
https://www.cnblogs.com/tianguiyu/articles/6091378.html

Linux调度器 - 进程优先级    好文
https://www.cnblogs.com/alantu2018/p/8447598.html

第八周:进程的切换和系统的一般执行过程
http://blog.chinaunix.net/uid-30180970-id-4986366.html
 

周期性调度器scheduler_tick
https://www.cnblogs.com/openix/p/3267772.html

Linux Scheduler – CFS and Red Black Tree  好文
https://oakbytes.wordpress.com/2012/06/08/linux-scheduler-cfs-and-red-black-tree/
 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值