Scheduling techniques for reducing processor energy use in MacOS
1. Scheduling techniques for reducing processor
energy use in MacOS
Jacob R. Lorch and Alan Jay Smith
CSL704 – Advanced Operating Systems
25/Jan/2019 – Class Presentation
Anurag Banerjee (2018CSM1007)
3. Introduction
What components consume power?
CPU, fan, physical drives
Components depend on each other
fan on CPU etc.
When on battery, high power consumption is undesirable
Battery life
Fan noise
3
4. Background
Work set in late 90’s
Focuses on PowerPC Duo 230 and 280c
Runs on System 7 OS later rebranded as Mac OS
It is a single user, single tasking OS
Single memory space for OS and user processes
4
5. Background (contd…)
“Macintosh lacks multitasking, but, tries to fake it…” – Byte, Sept. 1986
Uses co-operative multitasking – non-preemptive
Rapid process switching, when active window changes
Regular cycling of applications
Switching controlled by applications not OS
One process crashes – OS can crash
MacOS X Mojave is latest, renders most of this research obsolete
5
6. Research Problem
CPU major power consumer in System 7 or Mac OS 7
Does busy waiting
Identify and put CPU in low power state
This task is non-trivial
Heuristics to identify busy wait – parametric scheduling
6
7. Data
Trace-driven simulation data was collected from 6 Apple Computers, Inc. Engineers
Workload focused on engineer’s usage pattern
6 users, less data – can’t generalize results with high confidence
7
8. Methodologies
The optimum scheduling results are calculated theoretically
All strategies compared against it
The current scheduling strategy is compared with new strategies proposed by
authors
Comparison is done for processor energy savings and performance impact
For evaluation, performance impact of current strategy is taken as baseline
Scheduling is event driven, in a non-preemptive environment
8
9. Terms
Performance Impact: percent increase in workload runtime
Greediness Threshold: Count of CPU gain and yield without doing useful work
Block: when process has no event to process
Cooperative Multitasking: Processor only yields control when it wants to
Quantum: period between CPU assignment and yield of control
Event or Activity:
user input,
I/O device read or write,
any change in the appearance of the cursor,
any time spent with the cursor as a watch
Turns on sound chip
9
10. Strategies
Current Strategy(C): inactivity timer based – 2s no activity, 15s no I/O
Why inactivity timer? high overhead in CPU on/off
Schedule process even when not ready (OS)
Process can request CPU even if nothing to do (application)
Simple Scheduling Technique(I): do not schedule a process, when it requested to
be blocked (i.e., until conditions are fulfilled)
Greediness Technique(G): heuristic to decide if process making un-necessary
request and block it
Sleep extension technique(S): constant factor * sleep-times
Basic Strategy(B): Turn off processor when no process is available to run
10
11. Tools Used
IdleTracer: collects traces of events to simulate different strategies (authors
created)
ItmSim: simulates current Mac OS power management strategy
AsmSim: to simulate the proposed strategies
Process behavior on modified sleep time ignored
11
12. Results
(per strategy)
Optimal: 82% energy saving – 17.67% of useful work in 29.56 hours of trace
*(ES – energy saving, PI – performance impact)
C: 28.79% ES with 1.84% PI
Recovers 35% of idle time
B: 31.98% ES with 0% PI
Recovers 39% of idle time
BI: 47.10% ES with 1.08% PI
Recovers 57% of idle time
BIS: 51.72% ES for 1.84% PI, sleep multiplier of 2.25
BIG: 66.18% ES for 1.84% PI, forced sleep period of 0.52 and greediness threshold
of 61
Recovers 80% of idle time
12
13. Results
(per strategy)
BIGS: BIG is best BIGS for 1.84% PI
If sleep multiplier increased, bad results
changes on increasing PI threshold
Results have low sensitivity to these parameters
BIG > BIR > BIS > BI > C for energy saving
BIR – process requests a sleep time of zero, with probability p we force it to sleep for a period
f instead
For user 2, BIG > C > B
Finder – yield with sleep time zero
Greediness technique helps
Sleep extension technique useless
13
16. Results
(discussions)
Less data, possibility of type II error (when truth is rejected)
Useful quanta considered non-useful or other way round
Composite strategy BIG better than current
A: Average total Power consumption
P: Power consumed by components that remain on
S: Power saving by turning CPU off
𝐴 = 𝑃 +
1−𝐸𝑆
1+𝑃𝐼
𝑆
For given workload, current strategy consumed A = 8.27 W
For given workload, BIG strategy consumed A = 6.89 W
16
17. 17 Reciprocal of slope of the curve is an indicator of efficiency
18. Conclusion
“designers of OS and applications for single-user systems are not generally
concerned with rigorous management of processor time”
Rather compactness of code and short development cycle
Not scheduling non-useful quanta contributes to increased energy saving
Delay in scheduling useful quanta (due to sleep etc.) causes performance impact
This work is good for academic purposes, quite obsolete for present day
18
19. Future Research
Actually implement it in the OS and observe benefits in real time
Gather more trace data
Applicability to other single user OS (like those of Microsoft)
It may be re-emphasized that this direction of research is no longer relevant
19
Structure of presentation
Intro – motivation
Background – what was there in 90’s
Problem they focus on
Where they get data
SSD no optical drive – better
Blade less cooling systems
Powerpc - developed by AIM – apple, IBM, Motorola
System 7 is last of the classic Mac OS – now obviously discontinued
Process can monopolize
Even when nothing to do it will use CPU
Non trivial in the sense how do you recognize process is not doing useful work?
Thus come in the heuristics
A sum total of around 30 hours of trace data was collected
Optimum – for 30 hours of trace we know the useful times, calculate the actual runtime
Time – useful process work, process switching, bring process in/out, OS useful work, OS non-useful work
Current is old
Increase due to forced sleep
Mr. Lorch Created as part of Master’s thesis
ItmSim tries to duplicate proprietary MacOS strategy
Optimal around 5.3 hours of useful work
Observe the pattern of energy savings
Recovers idle time means – save the processor from busy wait