LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 943|回复: 3

请大家分析下面的代码。

[复制链接]
发表于 2003-11-2 12:35:16 | 显示全部楼层 |阅读模式
这是来自《莱昂氏UNIX源代码分析》的一个函数,小生没看动"&runout",请高手指点

setrun(p)
{
           register struct proc *rp;
           rp=p;
           rp->p_wchan=0;
           rp->p_stat=SRUN;
           if(rp->p_pri<curpri)
              runrun++;
           if(runout !=0&&(rp->p_flag&SLOAD)==0)
              {
                  runout=0;
                  wakeup(&runout);
              }
}


书上说&runout

“语法上是个地址变量,但是语义上是一个独特的位模式,这是一个在UNIX中处处都要使
用的方法实例,程序员由于某种特殊的目的需要一独特的位模式。只要它是独特的就满足
要求,其精确值并无意义,”。

小生实在没看懂,请大家帮忙
--
发表于 2003-11-3 11:00:44 | 显示全部楼层
没看过《莱昂氏UNIX源代码分析》,什么叫位模式?感觉&runout就是个地址变量:)
 楼主| 发表于 2003-11-3 11:02:33 | 显示全部楼层

郁闷

你还是看看吧,不看这个还来当斑竹啊?
发表于 2003-11-3 11:53:03 | 显示全部楼层
The runout flag is set whenever someone is swapped out. Sched sleeps on it awaiting work.

Sched sleeps on runin whenever it cannot find enough core (by swapping out or otherwise) to fit the selected swapped process. It is awakened when the core situation changes and in any case once per second.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表