
How OS X “Mavericks” works its power-saving magic - joshuacc
http://arstechnica.com/apple/2013/06/how-os-x-mavericks-works-its-power-saving-magic/
======
cpeterso
I'm surprised OS X didn't already using Timer Coalescing or lower process
priority of unfocused applications. The Linux kernel has used Timer Coalescing
for a long time. On Windows, there are utilities like Process Lasso that
enables user-configurable process priority adjustments.

~~~
mckilljoy
That was my first thought too -- Windows has had timer coalescing since at
least 2008, if not longer.

~~~
bdash
The whitepaper at [http://msdn.microsoft.com/en-
us/library/windows/hardware/gg4...](http://msdn.microsoft.com/en-
us/library/windows/hardware/gg463269.aspx) indicates that Windows timer
coalescing requires an application to explicitly opt in. The article describes
OS X Mavericks' support as applying to all upcoming timers while on battery
power (presumably excluding particular classes of timing-sensitive
applications, such as audio playback), which would be a much more aggressive
approach than in Windows.

~~~
mckilljoy
Yea that's fair. I was actually thinking of timer coalescing on the server OS
for improved power efficiency/performance -- I'm sure IIS, MSSQL, etc. all
opt-in to coalescing responsibly.

It sounds like the OSX version is more of a "forced timer coalescing" feature.

------
altcognito
> One of our Mac-using editors notes that the current version of Safari
> consumes about 15 percent of CPU resources when running in the background,
> so these power losses can be significant.

Seriously? I can't say I've had an app use more than 3-5% of my CPU while it
was sitting idle. I don't think it has anything with my OS. Is this what
others are experiencing?

~~~
cheald
Honestly, it's probably a flash ad somewhere.

Turning on plugin click-to-activate is good for power, too, not just security.

~~~
drivebyacct2
I'd sacrifice a lot to have that be the default, just out of charity for
everyone elses' benefit.

------
bluedino
Who owns the rights to QuarterDeck's old RamDoubler software? I can hear the
lawyers coming.

~~~
fuzzywalrus
I remember Connectix RAM Doubler, trying it and feeling how painfully it
slowed down OS 8. I believe it used virtual memory, (it had that goofy little
slider that let you "double" your ram) . I doubt it compression. Man, I almost
forgot about RAMDoubler

~~~
aaronharnly
I'm also filled with nostalgia ;). According to this post on the Ambrosia SW
page (more nostalgia!), Ram Doubler used both VM and compression. The piece is
light on technical details but fills in a bit more of the picture.

[http://www.ambrosiasw.com/ambrosia_times/january_96/3.1HowTo...](http://www.ambrosiasw.com/ambrosia_times/january_96/3.1HowTo.html)

------
jasonjei
I suspect that this technology works by optimizing the kernel process
scheduler by using some heuristics to determine what should be put to the
background (e.g determining what sort of syscalls are made, etc).

Will this technology be intelligent enough to know a network server process
(e.g socket syscalls)? Will there be a user method to override/exclude this
optimization on processes where this has an undesirable effect?

I think another good idea for OS developers is to push the concept of fibers
more over threads. Often a multi-threaded application can be re-patterned to
use fibers for immediate CPU optimization.

It sounds like a great OS improvement, especially coupled with SSDs. But I'm
hoping we can turn the magic off for certain processes when the magic gets too
crazy.

~~~
eddieplan9
The article talks about three technologies, and IMHO none is about putting
processes to background. The first one is about compressing pages instead of
swapping them to secondary storage. This should be a net gain in almost all
scenarios. The second - App Nap - only applies to GUI applications, and there
are opt-out controls. The third - Timer Coalescing - is the only one that has
the potential to alter application behavior, and it only kicks in when the
machines runs on battery.

~~~
masklinn
Apple seems to expect App Nap might create issues, the developer docs for the
feature have a note indicating:

> Note: If you experience problems with App Nap, you can temporarily disable
> it for a particular process by typing:

> defaults write <app domain name> NSAppSleepDisabled -bool YES

> Immediately file a bug describing the app and explaining how to reproduce
> the problem.

~~~
jemeshsu
Apple's note does not imply it's a design issue. Just that the software is not
ready and bugs are expected.

~~~
masklinn
> Apple's note does not imply it's a design issue.

At no point did I imply that. I was replying to eddieplan9's declaration that

> Timer Coalescing - is the only one that has the potential to alter
> application behavior

by noting Apple thinks App Nap may do so.

------
skierscott
Does a process that's running intensively (say, a python script in the shell)
still be limited, or does this only apply to NSWindows (or something similar)?

~~~
diroussel
Only apps with UI will be affected by Power Nap, I believe.

~~~
veidr
Pedantic correction: App Nap is the feature being discussed here to give less
CPU time to apps which don't need it.

Power Nap is the marketing name of the previously-released (in 10.8) feature
whereby a Mac in sleep mode still does things like check email, update
calendars, perform automatic photo downloads, etc.

~~~
diroussel
Opps, yep. I knew that! _blushes_

------
FiddlerClamp
It's a great idea - is there any word as to whether it's patented/patentable,
or might we see this on other OSes?

~~~
cheald
Timer coalescing has been around for _ages_. Linux and Windows both already do
it. Here's a 2009 article describing it in Windows:
[https://blogs.technet.com/b/askperf/archive/2009/10/03/windo...](https://blogs.technet.com/b/askperf/archive/2009/10/03/windows-7-windows-
server-2008-r2-core-parking-intelligent-timer-tick-timer-
coalescing.aspx?Redirected=true)

"App Nap" is a familiar concept to anyone who has ever played a game with
unfocused framerate caps (like most MMOs, for example). It being enforced by
the OS may be new, though. It kind of feels like a more aggressive `nice`
though.

~~~
melchebo
Apple had timer deadlines (much the same thing) in the kernel since the 10.5.5
release for their then new MacBook Airs, in November 2008.

------
ChikkaChiChi
I wonder if they are doing anything to further reduce SSD usage in the OS that
will help. Many of the tips people use to reduce wear and tear on their SSDs
(noatime, journaling, sleep image, etc.) seemingly would have further benefit
to saving on power.

~~~
melchebo
Current consumer SSDs even with developer / power user usage patterns should
be able to run for at least 30 years before the flash is no longer guaranteed
to work (1000 block wipes). The write amplification problem was mostly for the
first naive SSD implementations that would do a block wipe cycle on every
write. These naive SSDs have about 4 IOPS of 4K random write, you'll notice
that.

~~~
ChikkaChiChi
When I disable noatime I am not doing it to conserve write cycles, I'm doing
it to reduce I/O. Less electrical impulses running across my bus, the better.

