作者ms6163 ()
站内Programming
标题[问题] 有关real-time OS的问题
时间Fri Feb 16 17:51:38 2007
最近正在写一个RTOS.. 有关task time-out的部分 有些不太了解..
当一个task的execution time expired的时候..
是由谁来负责检查的??
case 1.
void task()
{
...........
if(time_out)
call_software_intr_for_context_switch();
// 这里可以用trap来写
...........
}
case 2.
_timer_handler:
save_regs_to_stack_point;
save_sp_to_current_TCP;
jump_to_timer_intr_jandler;
restore_regs_to_stack_point;
ret_to_the_task_be_interrupted;
void timer_intr_handler()
{
save_taskx_context();
if(taskx_time_out){
sched();
}
}
我自己是在timer handler里面作task的检查并且决定要不要作preempted的动作
但是看了很多的RTOS,他们好像都是由task来负责检查的动作(case 1),请问一下
这两个间的作法有什麽好坏的不同?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 70.162.73.236