Xen的调度分析 (五) ——关于RTDS调度算法简介
生活随笔
收集整理的這篇文章主要介紹了
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部分
轉載于:https://www.cnblogs.com/linanwx/p/5383269.html
總結
以上是生活随笔為你收集整理的Xen的调度分析 (五) ——关于RTDS调度算法简介的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 这几个朋友,我记得
- 下一篇: SQLServer数据通过sql插入GU