CS452 F23 Lecture Notes
Lecture 17 - 28 Nov 2023
1. Liu/Layland paper
- foundational work in fixed priority scheduling
- priority-driven, preemptive scheduling
- task “requests” driven by events, must be completed w/in some fixed time of request (“hard” real-time)
- task is a series of requests
- assumes periodic requests and constant run-time, so two-parameter characterization of tasks
- \(\tau_i\) is task \(i\) with request period \(T_i\) and run-time \(C_i\)
- more general model has a task deadline \(D_i\)
- also:
- independent task (no resource or precedence relationships)
- fixed computation time (upper bound at least)
- no voluntary suspension, tasks are fully preemptible
- no preemption overhead
- one processor
- task “requests” driven by events, must be completed w/in some fixed time of request (“hard” real-time)
- CS452 fit?
- fixed-priority scheduling - task priorities do not change
- the “scheduling” problem is the problem of assigning priorities to tasks
- definitions:
- overflow is a scheduling failure - occurs at the time some request received and previous instance is not finished
- scheduling algorithm is feasible if it schedules without overflow
- response time is finish time minus request time
- “critical instant” for a task when task will have largest response time
- Thm: critical instance for \(\tau_i\) occures when it requested simultaneously with all higher priority tasks
this yields a test to determine whether priority assignment leads to feasible schedule
- simulate execution up to first deadline of lowest priority task
- confirm that all requests (jobs) meet their deadlines
- necessary and sufficient test
- necessary because eventually all tasks will arrive at the same time
- sufficient because we’ve checked the worst-case response time of all tasks
\(i\) \(T_i\) \(C_i\) 1 10 2 2 5 2 3 3 1 - rate monotonic priority assignment - highest rate -> highest priority
- regardless of computation time
schedule examples
interval 1 2 3 4 5 6 7 8 9 10 \(T_1\) 1 \(T_2\) 2 2 \(T_3\) 3 3 3 3 schedule (\(\tau_3 > \tau_2 > \tau_1\)) 3 2 2 3 1 2 3 2 1 3 schedule (\(\tau_1 > \tau_2 > \tau_3\)) 1 1 2 schedule (\(\tau_2 > \tau_3 > \tau_1\)) 2 2 3 3 1 2 2 3 1 3 - first schedule (\(\tau_3 > \tau_2 > \tau_1\)) is rate monotonic
- second schedule fails has an overflow (not feasible)
- third schedule is not rate monotonic, but is still feasible
- rate monotonic assignment is optimal:
- if it cannot schedule a task set, no other assignment can schedule it either
- Thm: if a feasible priority assignment exists for task set, rate-monotonic is feasible
- utilization of a task \(\tau_i\) is \(C_i/T_i\)
- utilization of set of tasks is the sum of utilizations of tasks in the set
- utilization of example schedule = \(0.2+0.4+0.33 = 0.93\)
- Theorem: If utilization of a set of tasks is no more than \(n(2^{1/n}-1)\) and those tasks have rate monotonic priorities, they can be scheduled.
bound approaches \(ln(2) \approx 0.693\) as number of tasks increases
n bound 1 1 2 0.828 3 0.771 4 0.757 5 0.743 - utilization tests avoid need for simulation to determine feasibility
- if all \(C_i\) in the example schedule were 1, utilization would be about 0.63
- can conclude, without simulation, that that task set would be feasible with a rate monotonic priority assignment
- this is a sufficient test, not a necessary one
- task sets with higher utilizations might be schedulable
- example task set has higher utilization, but is still schedulable
- task sets with higher utilizations might be schedulable
If task periods are harmonic (each task’s period is an exact multiple of next most frequent task), than can schedule up to 100\% utilization
example:
\(i\) \(T_i\) \(C_i\) 1 12 2 2 6 2 3 2 1 - utilization is 100%, but feasible
interval 1 2 3 4 5 6 7 8 9 10 11 12 sched 3 2 3 2 3 1 3 2 3 2 3 1 \(T_1\) 1 \(T_2\) 2 2 \(T_3\) 3 3 3 3 3 3 - trick for improving schedulability
- transform task period to be harmonic
- if \(T_1 = 10\) and \(T_2 = 15\), transform \(\tau _1\) to have \(T_1 = 5\) and half the computation time
- can now schedule with utilization up to 100%
- why - now at most 1.5 \(\tau_1\)’s during each \(\tau_2\) period
- transform task period to be harmonic
- Under more general model where task has deadline \(D_i < T_1\), optimal policy is deadline monotonic: assign highest priority to tasks with shortest deadlines.
- dynamic priority scheduling: EDF
- highest priority to task whose current request’s deadline is nearest
example:
\(i\) \(T_i\) \(C_i\) 1 8 1 2 5 3 3 4 1 EDF schedule (rate-monotonic won’t schedule this)
interval 1 2 3 4 5 6 7 8 9 sched 3 2 2 2 3/1 3/1 2 2 \(T_1\) 1 1 \(T_2\) 2 2 \(T_3\) 3 3 3
- Thm: feasible iff \(C_1/T_1 + C_2/T_2 + C_m/T_m \leq 1\)
- EDF is optimal among all preemptive scheduling algs