作者crazyjoe (梨子)
看板Grad-ProbAsk
標題Re: [理工] [OS]-97逢甲
時間Mon Feb 8 18:13:57 2010
※ 引述《lovefo (lovefo)》之銘言:
: Scheduling in real time system: Consider two processes,P1 and P2,both
: starting at time 0,where,P1=45 and P2=60 are the periodic of processes P1 and
: P2,respectively;t1=25 and t2=30 are the processing times of processes P1 and P2,
: respectively.
: a.Can these two processes be scheduled using rate-monotonic scheduling?If yes,
: what's the total CPU utilization? If no,which process will miss the
: deadline first?
: b.Repeat the above question for the case of scheduluing these two processes
: using earliest-deadline-first(EDF) scheduling.
: 請問這種類型的排班要怎麼做阿???
: earliest-deadline-first 不懂...
※ 引述《lovefo (lovefo)》之銘言:
: Scheduling in real time system: Consider two processes,P1 and P2,both
: starting at time 0,where,P1=45 and P2=60 are the periodic of processes P1 and
: P2,respectively;t1=25 and t2=30 are the processing times of processes P1 and P2,
: respectively.
: a.Can these two processes be scheduled using rate-monotonic scheduling?If yes,
: what's the total CPU utilization? If no,which process will miss the
: deadline first?
: b.Repeat the above question for the case of scheduluing these two processes
: using earliest-deadline-first(EDF) scheduling.
: 請問這種類型的排班要怎麼做阿???
: earliest-deadline-first 不懂...
a.短的period time優先權較高
P2還沒做完,但P1的period到(45<60)所以搶奪CPU執行
↓ P2執行完TIME為80,超過60
↓ ↓
P1 P2 P1 P2
--------------------------
0 25 45 70 80
因為P2不能在deadline內完成,所以不能schedule
b.dynamic priority,較短的deadline有較高的優先權
P1,P2的(period time,deadline)如下:
P1:(0,45);(45,90) ;(90,135) ;(135,180);(180,225)....等
P2:(0,60);(60,120);(120,180);(180,240)....等
P1註(1)
↓ P2註(2) P1 P2
↓ ↓ ↓ ↓ | |
P1 P2 P1 P2 P1 P2 | |P1 continue...
------------------------------------------------------------------
0 25 55 80 110 135 165 180
註(1):45的時候P1的period time到了,但90(P1 deadline)>60(P2 deadline),
所以P2的優先權較高,繼續執行
註(2):60的時候P2的period time到了,但120(P2 deadline)>90(P1 deadline),
所以P1的優先權較高,繼續執行
後面的類推..........
由圖可看出能排班
畫的好亂 有錯請說QQ
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.243.66
推 yyc1217:請問a小題 為什麼第一個p2只能執行20呢? 謝謝 02/08 19:12
→ crazyjoe:因為P1的period到,且比P2的period小,所以preemptive 02/08 19:13