A Lock-Free Approach to Real-Time Object Sharing

advertisement
The Case for Multiprocessor Fair
Scheduling
James H. Anderson
University of North Carolina at Chapel Hill
Multiprocessor Fair Scheduling
Jim Anderson 1
Real-time Adaptivity on Multiprocessors

Motivating Application: Whisper
acoustic tracker for virtual environments.
Microphones
on ceiling
Speakers
on hands
and feet
Multiprocessor Fair Scheduling
User
Tracking
Computer
Jim Anderson 2
Whisper Characteristics

Workload requires a multiprocessor.

Predictive techniques used in tracking.
» Time to compute next prediction depends on
accuracy of previous prediction.
»  computational costs will vary.
» Lots of microphones/speakers  lots of tasks!
– Not practical to provision all tasks assuming max costs.

Question: How to ensure adaptive real-time
execution on a multiprocessor?
Multiprocessor Fair Scheduling
Jim Anderson 3
Multiprocessor Scheduling
Partitioning
Partition tasks so that each task always runs
on the same processor.
Steps:
1. Assign tasks to processors
(bin packing).
2. Schedule tasks on each
processor using uniprocessor
algorithms.
Multiprocessor Fair Scheduling
Jim Anderson 4
Problems with Partitioning
Variations in computation costs may
necessitate a re-partitioning.
 Problematic because:

» Partitioning = bin packing…
– …an intractable problem.
» Re-partitionings may cause task migrations…
– … the very thing partitioning is designed to avoid.
Multiprocessor Fair Scheduling
Jim Anderson 5
Global Scheduling
An Alternative to Partitioning
A single scheduling algorithm is used that
schedules all tasks.
Important Difference:
•
•
Tasks may migrate among
the processors.
Probably appropriate only on
tightly-coupled systems.
Rest of the Talk: Global scheduling algorithms
that facilitate real-time adaptivity.
Multiprocessor Fair Scheduling
Jim Anderson 6
Deadline Scheduling
Our Focus

We consider deadline scheduling
algorithms wherein:
» tasks repeatedly submit “pieces of work” to
the system to schedule;
» these pieces of work have deadlines;
» the system schedules work on an earliestdeadline-first basis.
Multiprocessor Fair Scheduling
Jim Anderson 7
The Periodic Task Model
The Simplest Form of Recurrent Execution…

Periodic Tasks:
» Task T = (T.e, T.p) releases a job with execution cost T.e
every T.p time units.
– T’s weight (or utilization or processor share) is T.wt = T.e/T.p.
» Each job of T has a deadline at the next job release of T.
5
2
T = (2,5)
U = (9,15)
0
Multiprocessor Fair Scheduling
5
10
15
20
25
30
Jim Anderson 8
Job-based Scheduling Doesn’t Work
Can’t consider jobs as the pieces of
work to schedule because deadlines can
be missed.
 Example: Scheduling three (2,3) tasks
on two processors.
missed

deadline!
Processor 1
Job 1 of Task 1
Processor 2
Job 1 of Task 2
0
Multiprocessor Fair Scheduling
1
Job 1 of Task 3
2
(These three
jobs have
equal deadlines
and hence are
indistinguishable.)
3
Jim Anderson 9
Alternative: Pfair Scheduling

Basic Ideas:
» Processor time is allocated in multiples of some
basic quantum.
» Break jobs into quantum-length subtasks. So, all pieces of
work to schedule
» Assign deadlines to subtasks.
have a cost of 1.

Previous Example:
Processor 1
Task 1
Job 1 of Task 3
task migration
occurs here
Processor 2
Multiprocessor Fair Scheduling
Task 1
Job 1 of Task 2
0
1
quantum
No deadlines
are missed!
2
3
Jim Anderson 10
Some Details…
Subtasks and Windows

Each subtask must execute within a certain
time window.
» End of window = deadline.
Window layout determined by task’s weight.
 Several optimal Pfair scheduling algorithms
are known.

» Optimal = capable of ensuring all subtask (and
job) deadlines as long as T T.wt  M (the no.
of processors)
Multiprocessor Fair Scheduling
Jim Anderson 11
Windowing Example
Deadline of T3
T6
Subtasks
T4
T5
T3
T2
T1
First
6 windows
of a task T
with weight
6/10
0 1 2 3 4 5 6 7 8 9 10
Windows may be of two different lengths, and successive
windows may overlap by one quantum.
Multiprocessor Fair Scheduling
Jim Anderson 12
Example Pfair Schedule
TIME
A
B
C
1/2
1/3
1/3
D
2/9
E
2/9
TASKS
Multiprocessor Fair Scheduling
5
On Processor 1
10
15
On Processor 2
Jim Anderson 13
Question: Can Non-periodic Recurrent
Tasks be Supported?

Yes!
» Developed the “early-release” (ER) model.
– Enables work-conserving behavior.
» Developed the “intra-sporadic” (IS) model.
– Generalizes the sporadic model.
» ER + IS = “rate-based”.
Multiprocessor Fair Scheduling
Jim Anderson 14
ER and IS Models
ERfairness (“Early Release”)
Idea: Allow a subtask to execute “early”, i.e., before its window.
Early Release
TIME 0
5
10
15
20
ISfairness (“Intra-Sporadic”)
Idea: Allow “delays” between subtask windows.
IS Delay
TIME 0
Multiprocessor Fair Scheduling
5
10
15
20
Jim Anderson 15
Question: Can Dynamic Tasks be
Supported?
(Dynamic = Tasks can Leave and Join)
Yes!
 Results:

» Devised rules under which tasks can leave
and join a running system.

These rules can be applied to adaptively
reweight tasks.
» Leave with old weight, join with new.
» However, a significant delay may be
incurred.
Multiprocessor Fair Scheduling
Jim Anderson 16
Question: Can Quick Adaptations be
Supported?
Yes!
 Two approaches:

» Reactive: Increase task shares when there is
idleness (available capacity).
– Resulting scheme: Quick-release fair (QRfair).
» Proactive: Allow tasks to register weight-change
requests with the scheduler.
– Resulting scheme: Proactive fair (PROfair).
Multiprocessor Fair Scheduling
Jim Anderson 17
Proactive vs. Reactive
(Figure depicts the window layout of one task)
No adaptivity
QRfair
(reactive)
idle processor encountered
 shift next window left
PROfair
(proactive)
increase weight to consume
available capacity
spare capacity
becomes available
Multiprocessor Fair Scheduling
Jim Anderson 18
QRfair Experiment
From RTSS 2003
Multiprocessor Fair Scheduling
Jim Anderson 19
Other Research





Devised efficient synchronization techniques
for Pfair-scheduled systems.
Devised techniques for discouraging task
migrations.
Devised techniques for minimizing bus
contention in such systems.
Developed a prototype threads package.
New Project: Use this threads package to reimplement Whisper.
Multiprocessor Fair Scheduling
Jim Anderson 20
Conclusions

Partitioning seems ill-suited for highly adaptive
multiprocessor systems.
» Moreover, partitioning has been studied for over 20
years and isn’t likely to improve.

The case for Global Scheduling (Pfair, in
particular) is likely to improve with further
research.
» More research needed (for example) on…
– support for device I/O,
– coupling feedback control mechanisms with adaptive
reweighting schemes,
– better techniques for discouraging migrations, particularly in
soft real-time systems,
– etc. etc. etc.
Multiprocessor Fair Scheduling
Jim Anderson 21
References
J. Anderson, A. Block, and A. Srinivasan, Quick-release fair scheduling, Proceedings of
the 24th IEEE Real-time Systems Symposium, pp. 130-141, December 2003.
J. Anderson, P. Holman, and A. Srinivasan, Fair multiprocessor scheduling, in Handbook
on Scheduling: Algorithms, Models, and Performance Analysis, Joseph Y. Leung (ed.),
Chapman and Hall/CRC, pp. 30.1-30.19, 2004.
J. Anderson and A. Srinivasan, Early-release fair scheduling, Proceedings of the 12th
Euromicro Conference on Real-time Systems, pp. 35-43, June 2000.
J. Anderson and A. Srinivasan, Mixed Pfair/ERfair scheduling of asynchronous periodic
tasks, Journal of Computer and System Sciences, 68(1):157-204, February, 2004.
Preliminary version appeared in Proceedings of the 13th Euromicro Conference on Realtime Systems, pp. 76-85, June 2001.
S. Baruah, N. Cohen, C.G. Plaxton, and D. Varvel, Proportionate progress: A notion of
fairness in resource allocation, Algorithmica, 15:600-625, 1996.
S. Baruah, J. Gehrke, and C.G. Plaxton, Fast scheduling of periodic tasks on multiple
resources, Proceedings of the 9th International Parallel Processing Symposium, pp. 280288, April 1995.
Multiprocessor Fair Scheduling
Jim Anderson 22
References (Continued)
U. Devi and J. Anderson, Fair integrated scheduling of soft real-time tardiness class on
multiprocessor platforms, Proceedings of the 10th IEEE Real-time and Embedded
Technology and Applications Symposium, pp. 554-561, May 2004.
U. Devi and J. Anderson, Improved conditions for bounded tardiness under EPDF fair
multiprocessor scheduling, Proceedings of 12th International Workshop on Parallel and
Distributed Real-Time Systems, April 2004 (on CD ROM).
U. Devi and J. Anderson, Schedulable utilization bounds for EPDF fair multiprocessor
scheduling, Proceedings of the 10th International Conference on Real-time and
Embedded Computing Systems and Applications, August 2004, to appear.
P. Holman, On the Implementation of Pfair-scheduled Multiprocessor Systems, Ph.D.
Dissertation, University of North Carolina at Chapel Hill, August 2004.
P. Holman and J. Anderson, Guaranteeing Pfair supertasks by reweighting, Proceedings
of the 22nd IEEE Real-time Systems Symposium, pp. 203-212, December 2001.
P. Holman and J. Anderson, Locking in Pfair-scheduled multiprocessor systems,
Proceedings of the 23rd IEEE Real-time Systems Symposium, pp. 149-158, December
2002.
Multiprocessor Fair Scheduling
Jim Anderson 23
References (Continued)
P. Holman and J. Anderson, Object sharing in Pfair-scheduled multiprocessor systems,
Proceedings of the 14th Euromicro Conference on Real-time Systems, pp. 111-120, June
2002.
P. Holman and J. Anderson, Using hierarchal scheduling to improve resource utilization
in multiprocessor real-time systems, Proceedings of the 15th Euromicro Conference on
Real-time Systems, pp. 41-50, July 2003.
P. Holman and J. Anderson, Implementing Pfairness on a symmetric multiprocessor,
Proceedings of the 10th IEEE Real-time and Embedded Technology and Applications
Symposium, pp. 544-553, May 2004.
M. Moir and S. Ramamurthy, Pfair scheduling of fixed and migrating periodic tasks on
multiple resources, Proceedings of the Twentieth IEEE Real-time Systems Symposium,
pp. 294-303, December 1999.
A. Srinivasan, Efficient and Flexible Fair Scheduling of Real-time Tasks on
Multiprocessors, Ph.D. Dissertation, University of North Carolina at Chapel Hill,
December 2003.
Multiprocessor Fair Scheduling
Jim Anderson 24
References (Continued)
A. Srinivasan and J. Anderson, Optimal rate-based scheduling on multiprocessors,
Proceedings of the 34th ACM Symposium on Theory of Computing, pp. 189-198, May 2002.
A. Srinivasan and J. Anderson, Efficient scheduling of soft real-time applications on
multiprocessors, Journal of Embedded Computing (to appear), special issue of best papers
from the 15th Euromicro Conference on Real-time Systems, 2003. Preliminary version
appeared in Proceedings of the 15th Euromicro Conference on Real-time Systems, pp. 5159, July 2003.
A. Srinivasan and J. Anderson, Fair scheduling of dynamic task systems on multiprocessors,
Journal of Systems and Software (to appear), special issue of best papers from the 11th
International Workshop on Parallel and Distributed Real-time Systems, 2004.
A. Srinivasan, P. Holman, and J. Anderson, Integrating aperiodic and recurrent tasks on fairscheduled multiprocessors, Proceedings of the 14th Euromicro Conference on Real-time
Systems, pp. 19-28, June 2002.
A. Srinivasan, P. Holman, J. Anderson, and S. Baruah, The case for fair multiprocessor
scheduling, Proceedings of the 11th International Workshop on Parallel and Distributed
Real-time Systems, April 2003 (on CD ROM).
Multiprocessor Fair Scheduling
Jim Anderson 25
Download