160 likes | 244 Views
CprE 458/558: Real-Time Systems. Dynamic Planning Based Scheduling. The big picture. Planning based scheduling approach. A planning based approach will evaluate different possible schedules for a given task set and chooses a final feasible schedule which satisfies all the constraints
E N D
CprE 458/558: Real-Time Systems Dynamic Planning Based Scheduling CprE 458/558: Real-Time Systems (G. Manimaran)
The big picture CprE 458/558: Real-Time Systems (G. Manimaran)
Planning based scheduling approach • A planning based approach will evaluate different possible schedules for a given task set and chooses a final feasible schedule which satisfies all the constraints • Ideally, one should evaluate all the possible schedules before choosing the final schedule. • However, the number of possible schedules for a reasonable number of tasks is huge. Therefore, all the possible schedules in the search space cannot be evaluated CprE 458/558: Real-Time Systems (G. Manimaran)
Scheduler model CprE 458/558: Real-Time Systems (G. Manimaran)
Scheduler model (contd.) • Schedulability checking (on-line) • by the scheduler • Schedule construction (on-line) • by the scheduler • Dispatching & Resource reclaiming • by the processors; each processor runs reclaiming algorithm when it finishes a task execution. Sched-check at a most opportune time (punctual point) • Too early: tend to reject tasks because reclaiming may not be exploited fully • Too late: if rejected, the application has no time to take any recovery action CprE 458/558: Real-Time Systems (G. Manimaran)
Task set model • Planning based scheduler assumes worst case computation time for each task • Planning based scheduler performs non-preemptive scheduling CprE 458/558: Real-Time Systems (G. Manimaran)
Planning based scheduling: search space • The search space for the planning based scheduling consists of different possible schedules for the given task set • A typical planning based scheduler will prune the search space by exploring different schedules and choose a final feasible schedule based on a heuristic function CprE 458/558: Real-Time Systems (G. Manimaran)
Search space: example Aperiodic Task set: Ti = (ri, ci, di) T1 = (0,2,8) and T2 = (1,5,6) Different possible schedules Schedule #1 T1 T2 2 0 6 7 8 Schedule #2 T2 T1 8 1 6 7 CprE 458/558: Real-Time Systems (G. Manimaran)
Spring/Myopic Scheduling Algorithm • Notations/Jargon • EATSK= earliest available time when resource Rk becomes available for shared access • EATeK= earliest available time when resource Rk becomes available for exclusive access • Avail_time(j) = earliest time at which the processor Pj becomes available for executing a task • EST(Ti) = Max(ri, min(avail_time(j)),max(EATUK) ) CprE 458/558: Real-Time Systems (G. Manimaran)
Understanding EST: Example R1 Time = 10 P1 Tx Time = 5 Arrival of tasks Ti Time = 3 EST(Ti) = max(3, 5, 10) = 10 CprE 458/558: Real-Time Systems (G. Manimaran)
Definitions • Feasible task: • A task Ti is feasible in a schedule if its timing constraint and resource requirements are met in the schedule, that is, if • EST(Ti) + Ci≤ Di. • Feasible schedule: • A schedule for a set of tasks is said to be a feasible schedule if all the tasks are feasible in the schedule. CprE 458/558: Real-Time Systems (G. Manimaran)
Definitions (contd..) • Strongly feasible schedule: • A partial schedule for a subset of tasks. A partial schedule is said to be strongly feasible if all the schedules obtained by extending the current schedule by any one of the remaining tasks within a window, called the feasibility check window K are also feasible. CprE 458/558: Real-Time Systems (G. Manimaran)
Spring/Myopic Scheduling Algorithm Heuristic search algorithm based on a notion of strong feasibility. Branch & Bound search. • Sort the “n” tasks in deadline order. • Check for strong feasibility for K tasks which are in the feasibility check window. (i.e., Check if EST(Ti) + Ci <= di) 3. If the current vertex is strongly feasible • Compute heuristic value Hi = di + W * EST(Ti) • Choose the best (smallest) H value, let it be Hx. • Extend the schedule with task Tx. CprE 458/558: Real-Time Systems (G. Manimaran)
Spring/Myopic Scheduling (contd.) 4. Else Backtrack to the previous vertex, Extend the schedule with next best task. 5. Repeat steps 2-4 until either: • Feasible schedule is obtained. • Maximum backtracks reached. • No more backtracking is possible. Algorithm Complexity: O(Kn + Backtracks). Exhaustive search algorithm: O(m^n) where m: # processors; n: # tasks. CprE 458/558: Real-Time Systems (G. Manimaran)
Myopic scheduling: Example Strongly feasible Search Tree Ordered by their deadlines H2 = 73 + 0 H1 = 80 + 0 H4 = 89 + 5 T2 on P1 (0,0) Strongly feasible H1 = 80 + 0 H4 = 89 + 5 H3 = 93 + 24 Strongly feasible T1 on P2 T5 on P2 (24,0) T2 Strongly feasible T1 T4 T3 T5 T4 on P1 Strongly feasible H4 = 89 + 24 H3 = 93 + 28 H5 = 108 + 35 (24,28) T3 on P1 Feasibility check window, K = 3 (49,28) (49,56) H3 = 93 + 49 H5 = 108 + 35 NOT Strongly feasible (88,28) (95,56) T3 on P1 Assume, w = 1 CprE 458/558: Real-Time Systems (G. Manimaran)
Myopic scheduling: Example Search Tree T2 on P1 (0,0) T4 on P1 (24,0) T1 on P2 T5 on P2 (24,28) T3 on P1 (49,28) (49,56) (88,28) (95,56) T1 T5 P2 28 35 56 T2 T4 T1 P1 24 49 56 95 Feasible schedule obtained using Myopic algorithm CprE 458/558: Real-Time Systems (G. Manimaran)