» 您尚未登录:请 登录 | 注册 | 标签 | 帮助 | 小黑屋 |


发新话题
打印

[新闻] 都在说界面,来点干货,OS X内核级改进

How OS X “Mavericks” works its power-saving magic
http://t.co/LGChQzyl97

那些只看到UI和外观设计的对手活该败呀(


Apple execs talk up the new features in OS X Mavericks.
At yesterday's Worldwide Developer Conference (WWDC) keynote, Apple made some bold claims about the future of battery life in its laptops. A new 13-inch Macbook Air, for instance, should now run a full 12 hours on a single charge, up from 7 in the previous model. Assuming that testing bears out Apple's numbers, how did the company do it? The obvious part of the answer is "Haswell"—but that turns out to be only part of the story.

The power efficiency gains found in Intel's new Haswell CPUs should provide modest gains in battery life, and such gains were widely expected. Back in January, Intel claimed that the new Haswell CPUs featured the "largest generation-to-generation battery life increase in the history of Intel" and said that the chips were the first of its architectures designed "from the ground up" for Ultrabooks and tablets. The new chips run at lower clockspeeds and at lower wattages.

Less expected was the announcement of OS X 10.9 "Mavericks" and its own focus on mobile power usage. While Apple made a few comments during the keynote about the new technologies meant to enable longer battery life, more information appeared later in the day with the separate release of a Core Technology Overview (PDF) document that offers a high-level look at some of the Mavericks internals.

The overarching goal of the power efficiency changes is of course longer battery life, but Apple claims that it can acheive this without harming "and in some cases even improving" overall system responsiveness. Three main technologies make this possible.

First up: compressed memory. Not ordinarily thought of as a power management tool, compressed memory "automatically compresses the least recently used items in memory, compacting them to about half their original size." When the items are needed, they are uncompressed and presented to the requesting program.

Apple claims that this compression/decompression cycle within memory is faster than swapping the information out to disk, even when that disk is an SSD, thanks to its use of the old WKdm algorithm. (And running Mavericks on older laptops with mechanical disks should result in even more dramatic savings.) A 2003 academic paper (PDF) comparing the speed of three "live RAM" compression algorithms concurs, concluding, "WKdm compresses and decompresses extremely fast, outperforming the other two [tested] algorithms in both respects." This frees overall memory, increases speed (compared with swapping to disk), and lowers disk wear, but Apple claims that it also "reduces the need to read and write virtual memory swap files on disk, improving the power efficiency of your Mac," despite the small increase in CPU usage due to the compression and decompression.

The second technology is App Nap. The new feature clamps down harder on apps that aren't in the foreground. (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.) The default scenario is to aggressively throttle resources when "an app's windows are not visible and the app is not playing audio" (though devs can override this behavior). When an app is "napping," OS X throttles its program timers, limiting their frequency to generate "significant improvements in CPU idle time when running applications that frequently check for data."

Disk and network activity are both more limited than before, too. A napping app receives the "lowest priority" for disk and network access, which is meant to reduce disk power usage but also to make foreground apps more responsive. "I/O throttling reduces the chance that a background process will interfere with the I/O activity of an app that you are actively using," says Apple.

Mavericks will also lower the UNIX process priority of any napping app so that it receives a smaller slice of CPU resources. Together, the changes should exert more control over background apps and keep their power consumption in check—though with opt-out controls for any apps designed to run at full power in the background.

Finally, Apple introduces something called Timer Coalescing, which only operates while a machine is on battery power. OS X programs are constantly setting timers that can activate the CPU, the disk, or the network link to do everything from checking DHCP WiFi leases to running Software Update to triggering an audible alarm. (Most of these timers result in action that is invisible to the user.) Because apps don't coordinate their timers at all, an idling Mac can be constantly awakened by firing timers, keeping CPUs and disks out of their lowest-power idle states.


Non-coalesced timers. Note the power use line across the bottom.
Apple
Timer Coalescing attempts to enforce some order on all this chaos. While on battery power, Mavericks will routinely scan all upcoming timers that apps have set and then apply a gentle nudge to line up any timers that will fire close to each other in time. This "coalescing" behavior means that the disk and CPU can awaken, perform timer-related tasks for multiple apps at once, and then return to sleep or idle for a longer period of time before the next round of timers fire.

Apple has never guaranteed developers that timers will run at exact times, either, so this isn't necessarily a break with convention. Apple currently tells developers that "because of the various input sources a typical run loop manages, the effective resolution of the time interval for a timer is limited to on the order of 50-100 milliseconds," and it notes that busy apps may have their timers affected even more. Current apps that set a 0.1s timer, for instance, only get something within +/- 0.00001s or so, and Apple sounds like it will get even more "approximate" with timer scheduling in Mavericks.

Apple claims the technique can "dramatically increase the amount of time that the processor spends idling, and it uses this illustrative chart to show the possible improvement in power usage.


After Timer Coalescing applied. Power usage line shows more overall idle time.
Apple
The new technologies exist alongside some kernel-level adjustments to the way CPU resources are used—Mavericks prefers to use as few cores as possible, leaving others totally idle so long as demand allows it. Paired with the Haswell improvements, Apple is making some dramatic claims for battery life improvements—and we'll be putting them all to the test.


本帖最近评分记录
  • 撸一管 激骚 +1 最骚 Rated by wap 2013-6-12 15:07
  • 撸一管 激骚 +1 最骚 Rated by wap 2013-6-12 15:07
  • 撸一管 激骚 +1 最骚 Rated by wap 2013-6-12 15:07
  • 撸一管 激骚 +1 最骚 Rated by wap 2013-6-12 15:07
  • 撸一管 激骚 +1 最骚 Rated by wap 2013-6-12 15:07

TOP

Timer Coalescing真不稀奇,Windows8早已实现,将中断延迟到一起以实现更长的CPU节能状态




TOP

Interrupt coalescing Linux 2.4就有了,compressed memory学术界早有论文,app nap大多是类unix内核早有的唯一的创新可能只有按需渲染,但那又怎样?我很高兴从10.6以后终于有一次如此多干货的升级(10.7的沙箱姑且算一个)。其实谈到省电,新版safari默认屏蔽非居中flash其作用可能比上文提到的3个加起来都大:D


TOP

普通用户谁懂这些,还不是看个UI最直观?

TOP

posted by wap, platform: iPhone

这次osx的ui有人吐槽?

TOP

我记得我最早看到Timer Coalescing是08还是09年。

今年是OSX后台搭建年,明年等爱抚有时间了就会来给我们磨玻璃了。

TOP

OS X和iOS内核一直是同一个版本号,我没说界面不重要啦,只是几年没管底层了今年终于大更新了一把怎么也值说一说吧

TOP

posted by wap, platform: iPad
引用:
原帖由 @阿毛  于 2013-6-12 10:51 发表
posted by wap, platform: iPhone

这次osx的ui有人吐槽?
ui调整不大,就是顶部的状态栏和背景融合了

TOP

再加一条,Intel集显终于支持OpenCL了,版本比官方驱动还高,懂的人知道其价值

Device Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz supports OpenCL 1.2
Device HD Graphics 4000 supports OpenCL 1.2

顺便OpenGL也更新到4.3了

更正,是4.1

[ 本帖最后由 mayokaze 于 2013-6-12 22:59 编辑 ]

TOP

引用:
原帖由 mayokaze 于 2013-6-12 13:54 发表
再加一条,Intel集显终于支持OpenCL了,版本比官方驱动还高,懂的人知道其价值

Device Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz supports OpenCL 1.2
Device HD Graphics 4000 supports OpenCL 1.2

顺便Ope ...
本人技术小白,求大概解释下。。。。

TOP

看演示用finder窗口遮蔽safari后cpu占用瞬间降至低点,屌爆了

TOP

引用:
原帖由 mayokaze 于 2013-6-12 13:54 发表
再加一条,Intel集显终于支持OpenCL了,版本比官方驱动还高,懂的人知道其价值

Device Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz supports OpenCL 1.2
Device HD Graphics 4000 supports OpenCL 1.2

顺便Ope ...
不知道啥时候ios开放opencl

TOP

引用:
原帖由 cloudchilya 于 2013-6-12 18:03 发表

本人技术小白,求大概解释下。。。。
简单来说就是从现在开始,苹果在售的所有Mac终于全部标配支持OpenCL1.2的显卡,OpenCL在Mac平台的可用性大大提升

TOP

不明觉厉!!!

TOP

posted by wap, platform: 大可乐 (MC001)
引用:
原帖由 @mayokaze  于 2013-6-12 22:41 发表
简单来说就是从现在开始,苹果在售的所有Mac终于全部标配支持OpenCL1.2的显卡,OpenCL在Mac平台的可用性大大提升
而且更多的pc主机可以轻松实现黑苹果

TOP

发新话题
     
官方公众号及微博