定时器汇聚

定时器汇聚是计算机系统的节能技术,通过降低软件定时器的精度以允许进程唤醒同步来节约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

参见

参考文献

  1. Anderson, Nate. . Ars Technica. June 11, 2013 [2014-03-22]. (原始内容存档于2017-02-22).
  2. . kernelnewbies.org. [2014-03-22]. (原始内容存档于2020-11-12).
  3. . 2007-05-08 [2014-03-22]. (原始内容存档于2013-05-04).
  4. . Man7.org. [2014-03-24]. (原始内容存档于2019-05-08).
  5. . Man7.org. [2014-03-24]. (原始内容存档于2021-02-24).
  6. . Microsoft. January 20, 2009 [2009-04-21]. (原始内容存档于2009-04-16).
  7. . Apple Inc. [2014-03-22]. (原始内容存档于2013-06-13).
  8. (PDF). Apple, Inc. June 10, 2013 [2013-06-10]. (原始内容 (PDF)存档于2013-06-26).
  9. . [2017-11-16]. (原始内容存档于2017-10-01).
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.