[理工] [OS]96中正資工
The background loop in a foreground / background system requires 90 ms to
complete if it is not interrupted. The flag DATA_RDY is polled once during this
background loop. If it is set, the system must respond and read in the
data that is ready. The foreground loop (ISR) in this system runs every 60 ms
and requires 30 ms to complete. Context switching time takes 1ms. Calculate
the worst-case response time of the system to recognize the DATA_RDY flag
(i.e. time from flag set to flag recognized). You must show your work for
full credit.
手邊的解答寫這樣:
最差狀況下取得DATA_RDY狀態反應時間,最差情況發生在background loop執行過程發生
2次中斷,假設background開始執行t,其中t<30則如下圖:
<--B--><-C-><--F--><-C-><--B--><-C-><--F--><-C-><--B-->
t 1 30 1 60 1 30 1 30-t
Response time= background loop 從開始到結束的時間 = t+1+30+1+60+1+30+1+(30-t)
=154ms
◎我的疑問是為什麼time from flag set to flag recognized(題目定義)
指的是background loop 從開始到結束的時間?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.247.53