Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 28

Overview of Scheduling for

Multiprocessor Real-Time
System

Xuan Qi
Outline
 Traditional Scheduling
 Multiprocessor Scheduling
 Real-Time Scheduling (single processor)
 Scheduling for Real-Time System on
Multiprocessor
Why Need Scheduling?
 Sharing always results in contention

 Intersection

 A scheduling discipline resolves contention


 Who’s next?
 Equivalent to assigning priority!!!
 E.g. Cashiers at grocery store --- minimize the waiting time,
fairness
Outline
 Traditional Scheduling
 Multiprocessor Scheduling
 Real-Time Scheduling (single processor)
 Scheduling for Real-Time System on
Multiprocessor
Traditional Scheduling
Problem and Goal
 Traditional Scheduling
 Problem: given a set of tasks t1 … tn, decides which
task gets the CPU time at a particular time
instance
 Goal:
 Minimize turnaround time
 Maximize throughput
 Maximize CPU utilization
 Minimize response time
 Fairness: avoid starvation
Traditional Scheduling
 System Configuration
 Single processor
 No time requirement

 Design Issues
 Application model
 Preemption
 Overhead

 Classic Scheduling Algorithms (assign priority)


 FCFS (Non-preemptive)
 SJF (Non-preemptive)
 Round-Robin (Preemptive)
Comparison
 FCFS:
 Pros: simple, low overhead
 Cons: average waiting time is highly variable
 Short jobs may wait behind long ones !!

 SJF:
 Pros: minimum waiting time and turnaround time
 Cons: starvation, can’t be implemented

 Round-Robin:
 Pros: simple, low overhead, works for interactive systems
 Cons:
 if quantum is too small, too much time wasted in context switching
 if too large (i.e., longer than mean CPU burst), approaches FCFS
What do we want to deal with
now?
 Multiprocessor
 Real-Time
 Time requirement
Outline
 Traditional Scheduling
 Multiprocessor Scheduling
 Real-Time Scheduling (single processor)
 Scheduling for Real-Time System on
Multiprocessor
Scheduling for Multiprocessor
 Problem
 Given a set J of jobs where job ji has length li and a number
of processors m, what is the minimum possible time
required to schedule all jobs in J on m processors such that
none overlap?

 Goal
 Minimize max execution time of all the processors
 E.g.
 Schedule 1: P1: 4, 5 P2: 1 EXECUTION TIME: 9
 Schedule 2: P1:4, 1 P2: 5 EXECUTION TIME: 5
 Workload balancing
 Bin-packing program: NP-Hard
Difficulties
 Not only when a given task executes
(scheduling)
 But where (assignment)
 Other issues
 resource constraints (shared cache or
memory)
 communication
Issues
 Partitioned or Global
 Homogeneous or heterogeneous
processors
 Application model
 E.g.: with or without dependency
Scheduling for Multiprocessor
 Global queue – queue can be a bottleneck

 Distributed queue – load balancing between


queue
Outline
 Traditional Scheduling
 Multiprocessor Scheduling
 Real-Time Scheduling (single processor)
 Scheduling for Real-Time System on
Multiprocessor
Real-Time Scheduling (single
processor)
 Problem
 Given a set of tasks t1 … tn, decide which task gets
the CPU time at particular time instance s.t. the
deadline of all tasks can be met.
 Order of execution the tasks
 Assign priority

 Goal
 Meet the deadline
 Fully utilize the CPU
 Energy & reliability consideration
Real-Time Scheduling (single
processor)
 What do we need to consider when
designing scheduling algorithm?
 Task model
 Preemption
 Priority assignment
 Fixed-priority: period, utilization
 Dynamic-priority: deadline
Real-Time Scheduling (single
processor)
 Task Model
 Periodic or Aperiodic
 With or without dependency
Classic Algorithms
 Assumptions [2]
 Single processor
 Task model: periodic
 Dependency: no
 Preemption: yes

 Fixed-Priority Algorithm
 Rate-Monotonic Scheduling: (RMS) [2]
 The task with shorter period has higher priority
 E.g. T1(1, 6), T2(1, 3), T3(5, 10)
 Priority: T2 > T1 >T3 FIXED!!!

 Dynamical-Priority Algorithm
 Deadline-Driven Scheduling: (EDF) [2]
 The task with earliest deadline has the highest priority
 Deadline = period * n
 E.g. T1(1, 6), T2(1, 3), T3(5, 10) T2 T1 T3 T2 T3
 At time 0: T2 > T1 > T3
 At time 1: T1> T3
 At time 2: T3
 At time 3: T2 > T3 DYNAMIC!!!
Summary of Classic
Algorithms
 Fixed-Priority Algorithm
 Rate-Monotonic Scheduling: (RMS)
 Optimal fixed-priority algorithm
 At least 0.693 system utilization (Liu & Layland Bound) [2]
 Statically 0.88 system utilization [4]

 Dynamical-Priority Algorithm
 Deadline-Driven Scheduling: (EDF)
 Optimal dynamic-priority algorithm
 Achieve system utilization 1 [2]

Note: system utilization = WCET / PERIOD


Outline
 Traditional Scheduling
 Multiprocessor Scheduling
 Real-Time Scheduling (single processor)
 Scheduling for Real-Time System on
Multiprocessor
Scheduling for Real-Time
Multiprocessor System
 Problem
 Decides which task gets the CPU time of which processor at a particular time
s.t. the deadline of all the tasks will be met

 Alternate Perspective
 Which task?
 Which processor? (assignment)
 What time? (scheduling)
 Meet deadline

 Goal
 Meet the time requirement
 Minimize the number of processors to use
 Energy management
 Reliability
Issues
 Homogeneous or heterogeneous
processors
 Application model
 E.g.: with or without dependency
 Resource constraints (memory, cache)
 Partitioned or Global
 Preemption
 Overhead
Classic Results
 Assumptions
 Homogenous processors
 Periodic tasks without dependency
 Resource constraints: No
 Preemption: Yes
 Overhead: will be discussed
 Global or partitioned?
 How to assign priority?
Global or Partitioned
 Global [1]
 How about borrowing the classic algorithms (RMS & EDF)?
 CPU utilization can be extremely low.
 Hard to guarantee to meet deadline
 Turns out to be very complex to design

 Partitioned [1]
 On each processor: the same as before
 Reuse classic algorithms (RMS & EDF)
 Easy to check if deadline is met with LLB
 May not exploit the hidden global beneficial feature
Intractability
 Global: RMS and EDF won’t work
 Neither of them is optimal any more [1]
 E.g. Rate-Monotonic Scheduling
 10 bag, each has capacity up to 10lb
 10 apples, each with weight 1lb, and another one apple with weight 9.1lb
 RMS: put into each bag one apple of 1lb first
 The 9.1lb apple won’t fit any bag
 Utilization 10% 10 bags
 Details can be found in [1]

 Partitioned:
 Similar to bin-packing problem …
 NP-Hard [3]
Heuristic Algorithms for
Partitioning
 First-Fit, Next-Fit, Best-Fit, Worst-Fit

 Liu and Layland Bound is used to guarantee


the schedulability on each processor

 Approximation bound are proved compared


to minimum number of processors to use
Summary & Future Work
 Summary
 Global scheduling for multiprocessor real-time system
 Very complex

 Partition-Based scheduling is more widely adopted and discussed.


 A lot of work has been done based on it.
 Heuristics to mininize the number of processors needed
 Workload balancing to achieve minimum energy consumption with dynamic
voltage/frequency scaling
 Bin-packing problem (NP-Hard)

 Future Work
 Scheduling for power saving
 Some work has already been done
 Use the redundancy to improve reliability
 Etc.
References
 [1] S. K. Dhall and C.L. Liu. On a real-time Scheduling Problem.
Operations Research, 26(1): 127-140, 1978.

 [2] C.L. Liu and J. Layland. Scheduling algorithms for


multiprogramming in a hard real-time environment. Journal of the
ACM, 20(1): 47-61, 1973.

 [3] J.Y.-T Leung and J. Whitehead. On the complexity of fixed-priority


scheduling of periodic real-time tasks. Performance Evaluation, 2:237-
250, 1982.

 [4] J. Lehoczky, L. Sha, and Y. Ding. The Rate Monotonic Scheduling


Algorithm: Exact Characterization And Average Case Behavior. In
Proceedings of the IEEE Real-Time System Symposium, pages 166-171,
1989.

You might also like