[問題] 有關real-time OS的問題

看板Programming作者時間18年前 (2007/02/16 17:51), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
最近正在寫一個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
文章代碼(AID): #15rNwjoG (Programming)
文章代碼(AID): #15rNwjoG (Programming)