Professional Documents
Culture Documents
09OS - Multiprocessor MultiThread RealTimeScheduling
09OS - Multiprocessor MultiThread RealTimeScheduling
Scheduling on a
multiprocessor
involves three
interrelated issues:
Design Issues
Actual Assignment
dispatching of processes
Use of to processors
of a process multiprogramming
on individual
processors
Processors
A disadvantage of static assignment is that one processor
can be idle, with an empty queue, while another
processor has a backlog
To prevent this situation, a common queue can be used
Another option is dynamic load balancing
Disadvantages:
• Failure of master brings down whole system
• Master can become a performance bottleneck
Performance of
scheduling
algorithms on 1.05 Dual
processor
multiprocessor
1.00
architectures 0.98
0 1 2 3 4 5
Coefficient of variation
1.25
1.25
Single
1.20 processor
multiprocessor Dual
processor
1.05
architectures
1.00
0 1 2 3 4 5
Coefficient of variation
Figure 10.1 Comparison of Scheduling Performance for One and Two Processors
Giorgio Giacinto 2019 Operating Systems 14
Thread Scheduling
ADVANTAGES:
BENEFITS
Dynamic Both the operating system and the application are involved
in making scheduling decisions
Scheduling
The scheduling responsibility of the operating system is
primarily limited to processor allocation
Bulldozer 2 MB
L2 Cache
2 MB
L2 Cache
Architecture 8 MB
L3 Cache
DDR3 Memory
Hypertransport 3.1
Controllers
32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB 32 kB
L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D L1-I L1-D
Intel Core i7- 256 kB 256 kB 256 kB 256 kB 256 kB 256 kB
990X L2 Cache L2 Cache L2 Cache L2 Cache L2 Cache L2 Cache
Architecture 12 MB
L3 Cache
Real-time
Process 1 Process 2 Process n process
Clock
tick
Scheduling time
Real-time
Current process process
Current process
Scheduling time blocked or completed
Request from a
real-time process Wait for next
Giorgio Giacinto 2019 Operating Systems 40
preemption point
Current process
Scheduling time blocked or completed
Request from a
real-time process Wait for next
preemption point
Real-time
Current process process
Preemption
Scheduling time
point
Real-Time (c) Priority-Driven Preemptive Scheduler on Preemption Points
Process Request from a
Real-time
Current process process
Scheduling time
Information Starting
• Time task must begin
deadline
Used for
Deadline Completion • Time task must be
Scheduling deadline completed
Scheduling
• A task may be decomposed
Subtask into a mandatory subtask and
scheduler an optional subtask
Example: A(3)
A(4)
40
60
10
10
60
80
Execution A(5)
•
80
•
10
•
100
•
Profile of Two •
•
•
•
•
•
•
•
Fixed-priority scheduling; B1 A2 A3 B2 A5
B has priority
A1 A2 B1 A3 A4 A5, B2
(missed) (missed)
Arrival times A B C D E
Requirements
Starting deadline B C E D A
A B C D E
Scheduling of Earliest
Arrival times
Service A C E D
Aperiodic deadline
Starting deadline B (missed) C E D A
Real-Time Arrival times A B C D E
Tasks Earliest
deadline
with unforced
Service B C E D A
idle times
Starting deadline B C E D A
Arrival times A B C D E
First-come Service
first-served A C D
(FCFS)
Starting deadline B (missed) C E (missed) D A
T2 = (5,2)
T3 = (7,2)
5 10 15
Monotonic (a) Arrival times and deadines for task Ti = (Pi, Ci);
Pi = period, Ci = processing time
Scheduling
1 2 3 4
Example T1 = (4,1)
1 2 3
T2 = (5,2)
1a 3a 3b 4a
T3 = (7,2)
5 10 15
Deadline miss
T3
t1 t2 t 3 t4 t 5 t6 t7 t8
Some Pathfinder tasks in decreasing order of priority
time
T1 -> Periodically checks the health of the spacecraft systems and software
(a) ->
T2 Unbounded priority
Processes inversion
image data
T3 -> Performs an occasional test on equipment status
s locked
blocked by T3 blocked by T3
by T1 s locked
(attempt to lock s) (attempt
s unlocked to lock s)
Priority T1
T1
Inversion T2
Example s locked
T2
preempted
by T1 s unlocked
by T3
preempted preempted
by T1 s unlocked
s locked by T2
T3
t1 t2 t 3 t4 t 5 t6 t7
T3
(b) Use of priority inheritance
t1 t2 t3 t 4 t5 t6 t7 t8
normal execution execution in critical section
time
(a) Unbounded priority inversion
Giorgio Giacinto 2019 Operating Systems 54
time
time
(a) Unbounded priority inversion
(a) Unbounded priority inversion
s locked
blocked by T s locked
blocked by T3 3 bybyT1 T1
(attempt to lock
(attempt to locks)s) s unlocked
s unlocked
T1T1
Priority T2
T2
Inheritance s locked preempted
s unlocked
by T3 by T1
preempted
s locked s unlocked
by T3 by T1
T3
t1 t2 t3 t4 t5 t6 t7
T3
t1 t2 t3 (b) Uset4of priority
t5 t6 inheritancet7