Title: CS523 Operating Systems
1CS523Operating Systems
- Fred Kuhns
- Applied Research Laboratory
- Computer Science
- Washington University
2Simplifying Precedence Constraints
- To accommodate precedence and timing constraints
derive a set of effective release times and
deadlines - Effective release time no predecessors then
equal to its release time. If predecessors then
maximum of its own and predecessor release times. - Effective deadline No successor, then original
deadline. Otherwise minimum of its deadline the
effective deadlines of its successors.
3Modeling System
- Modeling the system for an average response time
calculation - Assume
- Poisson arrival rate
- FIFO dispatch discipline
- No items dropped from queue
- General independent server times
- Single server, single queue
Tq Tw Ts Tw ?TsA / (1 - ?) A 1/21
(?Ts/Ts)2
? arrival rate
Departure
Dispatching Service
Server
w items in Q Tw Time waiting
Ts Service Time ? utilization ?Ts
q number of items in system, Tq total time in
system
4Average Response Time
...
B1
B2
B3
B5
B4
- View as one large sample space comprised of the
individual Task sample spaces (used to calculate
average and second moments, EBi and EBi2). - Individual events scale by 1/(1-U)
- eAi Bi/(1-U)
5Average Response Time
- Average queuing time inversely proportional to
the square of the aperiodic bandwidth (1-U). - Can improve average response of some jobs by
using priority queues.
6Scheduling Sporadic Jobs
- Sporadic jobs
- represent as S(d,e) d deadline, e execution
time - have hard deadlines,
- minimum interrelease times and maximum execution
time are not known in advance - maximum execution time is known on release
- jobs are preemptable
- Apply an acceptance test at run time
- When job is released, determine if there is a
feasible schedule that includes this sporadic job - If no feasible schedule, then reject job and
notify application of rejection
7Performing an Acceptance Test
- S(d,e) released at time t in frame x-1
- for example an interrupt is received in frame
x-1. - The deadline d is in frame (y1) gt
- S must complete in frame y
- Current total slack time available between frames
x and y (inclusive) Qc(x, y) - S is rejected if
- e gt Qc(x, y),OR
- some previously accepted jobs will not meet
deadline - Order waiting jobs using EDF
8Earliest Deadline First (EDF)
- EDF priority driven scheduling algorithm with
dynamic task (fixed job) priority assignment. - earlier the deadline, higher the priority
- priorities are assigned on job realease
- Jobs placed in run queue by priority
- Assumptions
- Tasks are preemptable and independent
- Tasks have arbitrary release times, arbitrary
deadlines - Single Processor
- Optimal EDF can produce a feasible schedule o a
set of Jobs J if and only if J has a feasible
schedule.
9Latest Release Time (LRT)
- Goes "backwards" in time Treats release times as
deadlines and deadlines as release times. - job with latest release time has highest priority
- May leave processor idle when jobs are ready, so
not a priority-driven algorithm. - Optimal LRT can produce feasible schedule for a
set of jobs J if and only if feasible schedules
for J exist.
10Least Slack Time First (LST)
- LST or Maximum Laxity First (MLF)
- Dispatch job with minimum slack time smaller
slack time, higher priority. - Optimal Can produce feasible schedules for J if
and only if feasible schedules for J exist. - Requires knowledge of execution times, while EDF
does not. Consequently may underutilize
processor when using maximum (worst-case)
analysis.
11Performing and Acceptance Test
- Beginning of each frame perform acceptance test
on any waiting sporadic tasks - Two steps
- Determine if sporadic task can complete execution
using available slack time (subtract any slack
time used by accepted tasks with deadlines before
d) - Determine if any already accepted sporadic tasks
with deadlines after d will be affected
12Implementation Calculating Slack Time
- Calculating the available slack time
- S was released within previous frame, (x - 1)
- S has deadline in frame (y 1) so must complete
execution no later than frame y - Acceptance test performed at start of frame x
- calculated between frame x and frame immediately
preceding deadline, frame y - if deadline is in frame x then S can not be
scheduled - Suffices to know original slack time between all
frame pairs within one major cycle, Q(x, y) for
x, y in H. - Assume x is in major cycle j and y is in major
cycle k - Q(x,y) Q(x,F) Q(1,y) (k - 1) - jQ(1,F) k
gt j - Q(x, y) is known if k j, y gt x.
- Q(x, x) is known, slack in current frame
13Accepting S Step 1
- If sporadic jobs are already in system then the
available slack time is given by - Qc(x, y) Q(x, y) - Sumdk?d (ek - e'k)
- slack plus remaining execution time of higher
priority tasks. - e'k time job k has already executed
- The sum is over all jobs with deadline dk ? d.
- If S is accepted
- Slack before new sporadic job's deadline
- Qs Qc(x, y) - e
- if job accepted store this value with job
- reject if Qs ? 0,
14Accepting S Step 2
- Check all jobs with deadlines after d to verify
they will not miss their deadlines. - d deadline of new sporadic task
- e execution time of new sporadic task
- Let Sl be the set of already accepted sporadic
tasks with deadlines after d. - Let Ql be the calculated slack for sporadic task
Sl - Accept if Step one is valid and te following
condition is valid - Ql - e ? 0 for all sporadic jobs with dl gt d.
15Summary Acceptance Test
- Scheduler must store the following
- Precomputed slack table, Q(x, y), x ,y 1, 2,
..., F - Completed execution time of accepted sporadic
jobs, e'k - Current slack (Qs) of every sporadic job
- Optimality of Cyclic EDF (on-line algorithm)
- it is optimal compared to other schemes that
perform an acceptance test at beginning of frames - Not optimal compared to algorithms performing
acceptance tests at arbitrary times. - However, this may impact the periodic tasks which
may be interrupted an arbitrary number of times
in order to perform acceptance tests for released
sporadic jobs.
16Practical Considerations
- Frame Overruns
- Abort job, schedule recovery job
- Execute unfinished portion as aperiodic job
- Continue executing job
- Mode changes system reconfiguration. Assume
periodic jobs are independent - Hard-deadline
- Soft-deadline
- Other Workloads
17Assessing Clock-Driven Scheduling
- Advantages
- Simplicity account for dependencies and resource
contention. No need for synchronization
mechanisms. - Timing constraints verified or enforced at frame
boundaries while minimizing overhead due to
context switches and IPC mechanisms. Simple
scheduling algorithm to minimize overhead. - Minimal impact of asynchronous system processing
(interrupts for example) - often verification is simple
18Assessing Clock-Driven Scheduling
- Disadvantages
- inflexible
- Model and implementation may be too simple and
restrictive - Difficult to add new components or change
existing system parameters - Release times must be fixed
- Must know all periodic parameters in advance
- operation modes must be explicitly enumerated and
scheduled