Chinaunix

标题: 调度... [打印本页]

作者: chenzhanyiczy    时间: 2010-02-05 15:40
标题: 调度...
A进程
调度策略:
SCHED_OTHER
优先级:
60

B进程:
调度策略:
SCHED_FIFO
优先级:
50

问:

同时启动A和B,那么A和B进程是如何运行的?
作者: topgun_007    时间: 2010-02-05 23:50
偶的理解:
对于实时进程,调度策略只是针对相同优先级的时候才会发挥作用。
如果有优先级高的实时进程,则总会执行它。
高优先级的所有实时进程都执行完成或者阻塞,低优先级的实时进程才有机会执行。
作者: openspace    时间: 2010-02-08 21:58
《ULK3》
     SCHED_FIFO
     A First-In, First-Out real-time process. When the scheduler assigns the CPU to the process, it leaves the process descriptor in its current position in the runqueue list. If no other higher-priority real-time process is runnable, the process continues to use the CPU as long as it wishes, even if other real-time processes that have the same priority are runnable.


不知道LZ用的内核是哪个版本
新的内核用的CFS,不知道是如何处理的
之前的内核使用O(1)调度算法时是采用ULK3中描述的方式的
以2.6.11为例,进程的优先级为0-139,其中0-99是实时进程,
调度方式有SCHED_FIFO和SCHED_RR
这里A的优先级低于B的优先级
A和B同时启动
   1)若A先执行,调度切换到B之后会一直等到B执行完成
   2)若B先执行,则A会等待B执行完毕之后再执行
   3)若都放入调度队列,但还未执行,根据调度队列的组织方式,先执行高优先级队列中的进程
       这样B先执行,A要等到B执行完毕后才有机会执行

没有看过CFS,应该与上面描述的情况不同
作者: iorifreedom    时间: 2010-02-10 12:07
学习一下!




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2