Efficient Timer Algorithm

前端 未结 3 611
無奈伤痛
無奈伤痛 2021-02-04 16:04

What is the best algorithm to implement a simple timer library. The library should allow the following:

  1. Timers to be started
  2. Timers to be stopped
3条回答
  •  天涯浪人
    2021-02-04 16:31

    Timers are typically best implemented in an operating system kernel, at the assembly/C level, making use of platform-specific features like APIC timers wherever possible.

    You might like to look at http://lwn.net/Articles/167897/ for details on the Linux implementation, and dig through the Linux source code to see working implementations.

提交回复
热议问题