Xen的调度分析 (五) ——关于RTDS调度算法简介
credit算法看的头晕,现在看一下RTDS算法,换换心情。
貌似中文文献为零,如果你是通过搜索引擎检索到了看过不要怪我太菜啊,我只是个机械专业的学生。。。
先把前言部分人话部分看一下吧,天书部分到后面再看:
/* * TODO: * * Migration compensation and resist like credit2 to better use cache; * Lock Holder Problem, using yield? * Self switch problem: VCPUs of the same domain may preempt each other; */ //任务: //对补偿和抗拒部分进行移植,类似credit2高效利用缓存 //锁的持有者问题,使用yield吗? //自开关的问题:同一个域的可能会互相抢占VCPU; /* * Design: * * This scheduler follows the Preemptive Global Earliest Deadline First (EDF) * theory in real-time field. * At any scheduling point, the VCPU with earlier deadline has higher priority. * The scheduler always picks highest priority VCPU to run on a feasible PCPU. * A PCPU is feasible if the VCPU can run on this PCPU and (the PCPU is idle or * has a lower-priority VCPU running on it.) * //设计思路 //该调度器遵循全局抢占最早时限优先(EDF)理论,用于实时调度领域 //在每次调度中,那些有更早期限的任务将会有更高的优先级 //调度器总是选择一个更高优先级的VCPU运行在可运行的物理CPU上。 //一个可运行的pcpu指的是一个VCPU可以运行在该pcpu上,(包括pcpu处于空闲或有低优先级任务) * Each VCPU has a dedicated period and budget. * The deadline of a VCPU is at the end of each period; * A VCPU has its budget replenished at the beginning of each period; * While scheduled, a VCPU burns its budget. * The VCPU needs to finish its budget before its deadline in each period; * The VCPU discards its unused budget at the end of each period. * If a VCPU runs out of budget in a period, it has to wait until next period. * //每一个VCPU都有专属的期限和预算 //一个VCPU的期限是每个周期的结束时间 //一个VCPU拥有的预算在每个周期的开始补充 //若调度,一个VCPU消耗他的预算 //一个VCPU必须在每一个周期内完成他的预算 //一个VCPU在每个周期丢掉未用完的预算 //如果在一个周期内VCPU用光了预算,就得等待下一个周期 * Each VCPU is implemented as a deferable server. * When a VCPU has a task running on it, its budget is continuously burned; * When a VCPU has no task but with budget left, its budget is preserved. * * Queue scheme: * A global runqueue and a global depletedqueue for each CPU pool. * The runqueue holds all runnable VCPUs with budget, sorted by deadline; * The depletedqueue holds all VCPUs without budget, unsorted; * * Note: cpumask and cpupool is supported. */ //每一个VCPU以可延期的服务实现 //当一个VCPU运行任务时,预算被持续的消耗 //当一个VCPU没有任务但是有剩余的预算,该预算被保留 //队列方案 //为每一个cpu池设置一个全局的运行队列和全局的耗尽队列 //运行队列保存所有的可运行的VCPU和预算,以期限排序 //耗尽队列以非排序的方式保存所有预算用完的VCPU /* * Locking: * A global system lock is used to protect the RunQ and DepletedQ. * The global lock is referenced by schedule_data.schedule_lock * from all physical cpus. * * The lock is already grabbed when calling wake/sleep/schedule/ functions * in schedule.c * * The functions involes RunQ and needs to grab locks are: * vcpu_insert, vcpu_remove, context_saved, __runq_insert */ //全局的锁用于保护runq和depletedq //全局的锁由所有物理CPU在schedule_data.schedule_lock引用 //schedule.c中每次唤醒/睡眠/调度函数运行时,已经上锁了 //包含runq的函数,需要上锁的有VCPU的插入移除、运行队列插入、上下文保存
后面又出现了很多cpumask部分,看来需要看的东西实在是太多了。
因为之前的credit负载平衡也有很多cpumask部分,所以下一篇开始看cpumask部分