该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
SD调度器全名是Staircase-Deadline,这个调度器由Con Kolivas开发,
SD调度器的进程的优先级是静态的,最基础的优先级来源于task_struct结构体的
static_prio,也就是用户的nice值,sd调度器的运行队列结构体如下:
struct rq {
spinlock_t lock;
unsigned long nr_running;
unsigned long raw_weighted_load;
unsigned long long nr_switches;
unsigned long nr_uninterruptible;
unsigned long expired_timestamp;
unsigned long long most_recent_timestamp;
struct task_struct *curr, *idle;
unsigned long next_balance;
struct mm_struct *prev_mm;
struct prio_array *active, *expired, arrays[2];
int best_expired_prio;
atomic_t nr_iowait;
struct lock_class_key rq_lock_key;
};
大家把SMP和SCHEDSTATS先忽略了。首先调度器结构体成员lock就是runqueue的自旋锁,
是用来确保多CPU的安全。nr_running是指在该CPU的runqueue上的TASK_RUNNING进程的个数。
nr_switches是上下文切换的次数。nr_uninterruptible是TASK_UNINTERRUPTABLE睡眠进程的个数
curr是当前运行着的进程,active, expired, arrays就是运行队列了,不过可以把expired
给忽略了,因为SD调度器是多级反馈队列。