Chinaunix首页 | 论坛 | 博客
  • 博客访问: 439383
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-09-16 21:27:26

 

struct task_struct {
...
int prio, static_prio, normal_prio;
unsigned int rt_priority;
struct list_head run_list;
const struct sched_class *sched_class;
struct sched_entity se;
unsigned int policy;
cpumask_t cpus_allowed;
unsigned int time_slice;
...
}


step 1: prio and normal_prio indicate dynamic priority; static_prio indicate static priority.

Static priority is assigned when process was created.

normal_prio denotes a priority that is computed based on the static priority and scheduling policy of process.

Identical static priorities will therefore result in different normal priorities depending on whether a process is a regular or a real-time process. When a process forks, the child process will inherit the normal priority.

However, the priority considered by the scheduler is kept in prio. A third element is required because situations can arise in which the kernel needs to temporarily boost the priority of a process. Since these changes are not permanent, the static and normal priorities are unaffected by this.

STEP 2: rt_priority denotes the priority of a real-time process. Note that this does not replace the previously discussed values! The lowest real-time priority has value 0, whereas the highest priority is 99. Higher values correspond to higher priorities. The convention used here is different from the convention used for nice values.

STEP 3: sched_class denotes the scheduler class the process is in.

STEP 4: se is embed in task_struct, on which scheduler operate on.

STEP 5:
policy holds the scheduling policy applied to the process. Linux supports five possible values:
  • SCHED_NORMAL is used for normal processes on which our description focuses.
  • SCHED_BATCH is for CPU-intensive batch processes that are not interactive.
  • SCHED_IDLE tasks will also be of low importance in the scheduling decisions, but this time because their relative weight is always minimal.Note that SCHED_IDLE is, despite its name, not responsible to schedule the idle task.
  • SCHED_RR implements a round robin method.
  • SCHED_FIFO uses a first in, first out mechanism.

SCHED_RR and SCHED_FIFO are used to implement soft real-time processes, others for CFS scheduling.

STEP 6: cpus_allowed is a bit field used on multiprocessor systems to restrict the CPUs on which a process may run.

STEP 7: run_list and time_slice are required for the round-robin real-time scheduler, but not for the completely fair scheduler. run_list is a list head used to hold the process on a run list, while time_slice specifies the remaining time quantum during which the process may use the CPU.


阅读(937) | 评论(1) | 转发(0) |
0

上一篇:NOTE

下一篇:进程使用proc导出信息

给主人留下些什么吧!~~

chinaunix网友2010-09-17 16:02:06

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com