FreeBSD 5 内核源代码分析之中断处理( 八 )
}
return (ithread_add_handler(ithd, name, handler, arg,
(pri * RQ_PPQ)PI_SOFT, flags, cookiep));
}
3.2调度
硬件时钟中断,需要处理非紧急时钟事务时,调度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"));
}
}
推荐阅读
- 1、系统安装 FreeBSD网站平台建设全过程
- 用FREEBSD作开发的一些实现方式
- FreeBSD下的内存文件系统
- FreeBSD中/etc下的文件简介
- FreeBSD下Apache2.0运行模型分析及性能调整
- 试用QEMU,安装个FreeBSD 5.3
- FreeBSD下有关分区和mount的一些问题
- RSYNC ON FreeBSD 5.2 HOWTO V1.0
- 系统核心 自订 FreeBSD Kernel
- 一些FreeBSD相关的安全问题