[問題] 有關real-time OS的問題
最近正在寫一個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
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Programming 近期熱門文章
PTT數位生活區 即時熱門文章