3.2调度

2009-05-13 08:08:36来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


硬件时钟中断,需要处理非紧急时钟事务时,调度softclock,以便在响应完硬件时钟中断后运行softclock。
代码:
/*
* The real-time timer, interrupting hz times per second.
*/
void
hardclock(frame)
  register struct clockframe *frame;
{
  ......
  if (need_softclock)
    swi_sched(softclock_ih, 0);
  ......
}
/*
* Schedule a heavyweight software interrupt process.
*/
void
swi_sched(void *cookie, int flags)
{
  struct intrhand *ih = (struct intrhand *)cookie;
  struct ithd *it = ih->ih_ithread;
  int error;
  atomic_add_int(&cnt.v_intr, 1); /* one more global interrupt */
   
  CTR3(KTR_INTR, "swi_sched pid %d(%s) need=%d",
    it->it_td->td_proc->p_pid, it->it_td->td_proc->p_comm, it->it_need);
  /*
  * Set ih_need for this handler so that if the ithread is already
  * running it will execute this handler on the next pass. Otherwise,
  * it will execute it the next time it runs.
  */
  atomic_store_rel_int(&ih->ih_need, 1);
  if (!(flags & SWI_DELAY)) {
    error = ithread_schedule(it, !cold && !dumping);
    KASSERT(error == 0, ("stray software interrupt"));
  }
}


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38079/showart_302018.html

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:3.1登记

下一篇:freebsd 5内核源代码分析之copyin()实现原理