INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction...

33
Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques Conclusion INFO-F404, Operating Systems II Jo¨ el GOOSSENS Universit´ e libre de Bruxelles Jo¨ el GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 1–33

Transcript of INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction...

Page 1: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

INFO-F404, Operating Systems II

Joel GOOSSENS

Universite libre de Bruxelles

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 1–33

Page 2: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Low-power scheduling

C) Low-power scheduling

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 2–33

Page 3: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Outline

I MotivationsI Introduction to hardware aspectsI Introduction to software aspectsI Popular techniquesI Conclusion

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 3–33

Page 4: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Motivations/Applications I

I On PDAs, smartphones and laptops, saving battery life meanscreating less hazardous waste for the same level of functionality.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 4–33

Page 5: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Motivations/Applications II

I Medical implant, pacemakers, controller can use the energy of ourmuscles.

I Artificial retinas (prototypes) use incidental light as an energysource.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 5–33

Page 6: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Motivations/Applications III

I In aerospace. For instance, the Mars Odyssey spacecraft wasdesigned to use less battery power and smaller solar panels.

I More generally, low power consumption implies less heatdissipation.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 6–33

Page 7: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

CMOS circuit power consumption

I Ptot = Pstatic + Pdyn

I Static currents, leakage (due to transistor imperfections)I Dynamic currents (circuit switching)I The following can be used as an approximation of the dynamic

power:Pdyn ≈ α · f · C · V2

dd

I whereI f is the clock frequencyI α is the activity rate (related to switches)I C is the capacityI Vdd is the supply voltageI f ≈ V(γ−1)

dd is the switching frequency

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 7–33

Page 8: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Abstraction

We will assume that γ ≈ 2 as well as the following:

I Speed/computational capacity ∝ Vdd

I Power consumption ∝ V3dd

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 8–33

Page 9: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Energy

We’ll focus on energy consumption: E =∫ t

0 P(t)dt

E = ` · 2 · V3dd

Vdd

E = ` · 4 · ( Vdd2 )3 = ` · V3

dd2

Vdd

2

4

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 9–33

Page 10: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Real-time systems

I Real-time systems are systems whose reliability not only dependson the correctness of computations but also on the instants whenthe results are produced. Typically, each computation must becompleted while meeting a deadline.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 10–33

Page 11: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Modeling real-time applications

Definition 1 (Periodic tasks)A periodic task τi is characterized by a tuple (Ti,Ci), where

I Ci is its worst-case execution time which specifies an upper boundon the execution time of each job generated by τi.

I Ti is the period specifying the interval of time separating twoconsecutive requests of task τi.

I We assume implicit deadlines. The absolute deadline of a job isexactly the arrival time of the next job of its task.

Note: Ci may be a number of processor cycles (absolute referential) or aduration based on a reference processor frequency (relative referential).

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 11–33

Page 12: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Periodic task example

τ1 = (T1 = 10,C1 = 3)

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

ppppppppppppppp

? ?

0 2

3

10 12

3

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 12–33

Page 13: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

System load

Definition 2 (Utilization)The utilization Ui(f) of a task τi is the ratio between its worst-case

execution time and its period: Ui(f)def= Ci(f)/Ti.

The utilization of a periodic task system is the sum of the utilizations of

all tasks: U(f) def=

∑τi∈τ Ui(f)

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 13–33

Page 14: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Scheduling

I Scheduling is the computer science term denoting the decisionprocess of choosing which process should be run.

I The operating system regularly executes an algorithm called ascheduler that chooses which process should be run.

I If the process chosen is not the same as that which ran previously,we must proceed with a context switch (also called preemption).

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 14–33

Page 15: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Time-sharing vs. real-time

I Schedulers using time-sharing are present on most general-purposecomputer systems.

I Real-time schedulers can guarantee that jobs get completed intime.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 15–33

Page 16: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Earliest Deadline First — EDF

Definition 3 (EDF)

At each instant, EDF gives highest priority to the active job whoseabsolute deadline is smallest (i.e. closest).

The following example showcases EDF used on a task system with twotasks: τ1 = (T1 = 2,C1 = 5), τ2 = (T2 = 2,C2 = 4).

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

ppppppppppppppppppppppppppppppppppp

τ2

? ? ? ? ? ?

0 1

2

4 5

2

8 9

2

12 13

2

17 18

2

τ1

? ? ? ? ?

2 4

2

6 7

2

10 11

2

15 16

2

20 21

2

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 16–33

Page 17: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Assumptions

I EDF schedulerI preemptive systemI negligible preemption delaysI uniprocessor platform

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 17–33

Page 18: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

An offline technique I

This first technique uses the following condition as basis:

Condition 4A system is EDF-schedulable at frequency f if and only if

U(f) 6 1

I The basic idea will be to work with the smallest frequency f suchthat U(f) 6 1 still holds.

I For instance, for the task system made of two tasksτ1 = (T1 = 2,C1 = 5) and τ2 = (T2 = 2,C2 = 4), we haveU(1) = 0.9. Therefore, we could work with a frequency of 0.9,which amounts to multiplying execution times by 1.111 . . .

I U(0.9) = 1

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 18–33

Page 19: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

An offline technique II

τ2? ? ? ? ? ?

0 1

2

4 5

2

8 9

2

12 13

2

17 18

2

τ1? ? ? ? ?

2 4

2

6 7

2

10 11

2

15 16

2

20 21

2

U(1) = 0.9

τ2? ? ? ? ? ?

2.22 6.66 11

τ1? ? ? ? ?

4.44 8.88

U(0.9) = 1

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 19–33

Page 20: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Reminder

Note that the quadratic relation between frequency and powerconsumption implies that we’re saving energy!

E = ` · 2 · V3dd

Vdd

E = ` · 4 · ( Vdd2 )3 = ` · V3

dd2

Vdd

2

4

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 20–33

Page 21: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

DVFS online techniques — Generalities

I Offline techniques are based on the worst-case execution times(WCET).

I Online techniques use data collected during system execution.I Frequencies may be adjusted during system execution.I Dynamic Voltage Frequency Scaling (DVFS) technology

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 21–33

Page 22: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Dynamic Reclaiming Algorithm — DRA [1]

I The DRA technique tries to exploit early job completions.I Part of the offline schedule is used to meet deadlines, but with the

ability to scale down frequency/voltage at times.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 22–33

Page 23: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

DRA — Illustration

t1

t2 t3

t3

Early completion

Offline scheduling

Online scheduling without DRA

Online scheduling with DRA

τ1

τ2

τ1

τ2

τ1

τ2

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 23–33

Page 24: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Evolution of dissipated power

1990 1995 2000 2005 2010 2015 2020

102

1

10-2

10-4

10-7

Dynamique Statique Technologie

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 24–33

Page 25: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Power-saving in recent embedded processors

I Hardware mechanisms to control leakage current.I Used during sufficiently long idle periods.I Deactivation of cache blocksI Handling of power-saving modes: freeze, hibernation, cryo modes.I Recent processors have automatic mechanisms that activate during

significantly long idle periods.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 25–33

Page 26: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

LC-EDF — Leakage-Control EDF [2]

I During an idle period of the processor, we’ll attempt to postponejob executions as far as possible.

n∑i=1,i 6=k

Ci

Ti+

Ck + ∆k

Tk= 1

idle

τk

idle

∆kDk

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 26–33

Page 27: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

LC-EDF

I The same principle applies to later requests of higher priority.n∑

i=1,i 6=k,j

Ci

Ti+

Ck + δk

Tk+

Cj + ∆j

Tj= 1

idle

τk

idle

δkDk

τj

∆j

Dj

∆k

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 27–33

Page 28: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Recent research: multiprocessor platforms

I We are reaching the (physical) limits of uniprocessor platforms withregards to clock frequency and integrated circuit density.

I Increasing computational power implies having to use parallelcomputing, multiprocessor or multicore platforms.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 28–33

Page 29: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Potential power-saving through parallelism I

As a quick reminder:

I Speed/computational power ∝ Vdd

I Power consumption ∝ V3dd

A platform with m processors gives the same computational power ifeach processors works at a “speed” of Vdd

m . However, powerconsumption becomes:

m · (Vdd

m)3 =

V3dd

m2

We gain a factor of m2!

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 29–33

Page 30: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Potential power-saving through parallelism II

� limm→∞ energie nulle

However, real-time jobs are sequential.

“While increasing the number of processors results in lower energyconsumption for a given computing capacity, the fraction of thatcapacity that is guaranteed available for executing the real-timeworkload decreases as the number of processors increases.”

—S. Baruah & J. AndersonInternational Journal of Embedded Systems, 2008.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 30–33

Page 31: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Conclusion

I We have demystified power-saving in digital critical systems.I We have illustrated the pivotal role of computer science research in

reducing production of toxic waste and heat dissipation ofelectronic equipment.

I We have stressed the new challenges that arise in parallelembedded systems.

I There is a large place for new fresh ideas and technologicalinnovations.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 31–33

Page 32: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

Questions

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 32–33

Page 33: INFO-F404, Operating Systems IIfuuu.be/polytech/INFOF404/Cours/slides_Energy.pdf · Introduction Introduction to hardware aspects Introduction to software aspects Some existing techniques

IntroductionIntroduction to hardware aspectsIntroduction to software aspects

Some existing techniquesConclusion

References I

[1] AYDIN, H., MELHEM, R., MOSSE, D., AND MEJIA-ALVAREZ, P.Power-aware scheduling for periodic real-time tasks.IEEE Transactions on Computers 53, 5 (2004), 584–600.

[2] LEE, Y., REDDY, K., AND KRISHNA, C.Scheduling techniques for reducing leakage power in hard real-timesystems.In 15th Euromicro Conference on Real-Time Systems (2003), IEEE,pp. 105–112.

Joel GOOSSENS (U.L.B.) INFO-F404, Operating Systems II 33–33