定时器汇聚

维基百科,自由的百科全书

定时器汇聚是计算机系统的节能技术,通过降低软件定时器的精度以允许进程唤醒同步来节约CPU被迫执行的昂贵的进入与退出空闲状态英语idle (CPU)的次数,从而降低CPU能耗。[1]

Windows的定时器汇聚[编辑]

如果处理器的空闲周期非常短暂,处理器进入与退出低功率状态的能耗甚至会大于空闲状态所节约的能耗。定时器汇聚帮助改进了周期软件行为的能耗效率,这是通过把多个不同的软件定时器在同一时间到期,从而增加了处理器平均空闲周期的长度。

Microsoft建议软件开发者首先检查能否去除周期性行为,可用事件驱动或者基于中断的设计来代替。否则,应当使用定时器汇聚,至少使用32毫秒的定时器到期容限。[9]这对应于两个缺省系统时钟间隔(15.6毫秒)。建议软件定时器间隔与容限都应是50毫秒的倍数。

设备驱动程序应该使用新的内核态API函数KeSetCoalescableTimer替代KeSetTimerEx。它的参数TolerableDelay指出定时器到期容限的毫秒数。

用户态程序从Windows Vista开始支持SetThreadpoolTimer。从Windows 7开始使用Windows API函数SetWaitableTimerEx替代SetWaitableTimer。从Windows 8开始,使用Windows API函数SetCoalescableTimer

Linux的低分辨率定时器[编辑]

参见[编辑]

参考文献[编辑]

  1. ^ Anderson, Nate. How OS X “Mavericks” works its power-saving magic. Ars Technica. June 11, 2013 [2014-03-22]. (原始内容存档于2017-02-22). 
  2. ^ Linux Kernel 2 6 22. kernelnewbies.org. [2014-03-22]. (原始内容存档于2020-11-12). 
  3. ^ Add support for deferrable timers. 2007-05-08 [2014-03-22]. (原始内容存档于2013-05-04). 
  4. ^ time(7) - Linux manual page. Man7.org. [2014-03-24]. (原始内容存档于2019-05-08). 
  5. ^ prctl(2) - Linux manual page. Man7.org. [2014-03-24]. (原始内容存档于2021-02-24). 
  6. ^ Windows Timer Coalescing. Microsoft. January 20, 2009 [2009-04-21]. (原始内容存档于2009-04-16). 
  7. ^ OS X Mavericks - Advanced Technologies. Apple Inc. [2014-03-22]. (原始内容存档于2013-06-13). 
  8. ^ OS X Mavericks: Core Technologies Overview (PDF). Apple, Inc. June 10, 2013 [2013-06-10]. (原始内容 (PDF)存档于2013-06-26). 
  9. ^ Windows Timer Coalescing,January 20, 2009. [2017-11-16]. (原始内容存档于2017-10-01).