› Forums › Personal Topics › Unbidden Thoughts › Efficient Linux Interfaces For Timestamps and Timers
This topic contains 2 replies, has 1 voice, and was last updated by
Josh Stern May 28, 2023 at 9:31 am.
-
AuthorPosts
-
May 28, 2023 at 8:54 am #126370

Josh Stern
ModeratorThis article – https://blog.gopheracademy.com/advent-2016/go-timers/ – describes a 2016 implementation of timers in Go language using a separate “goproc” – there’s not enough info there to say if it is efficient or in what sense of efficiency it succeeds. My concept of efficiency would involve using estimates of how long we can safely sleep until action is needed.
-
May 28, 2023 at 9:31 am #126371

Josh Stern
ModeratorMeta Discussion:
I didn’t notice a source that attempted to define the features of timing that an optimal timer design would try to optimize. Intuitively, a multitasking system has many different processes and threads, and any given thread will only be active for some slice of time with some probability distribution governing of how long that slice is and, especially, the distribution of exact length of time between wakeups. Initiating an in-process event at a precise time is an act of engineering approximation. What are the properties of the best approximation? So combination of avg and worst case accuracy and how muc extra CPU work is required to implement that level of accuracy. One can design a system that takes preferences as parameters, and the developer user may or many not set them in a way that achieves the desired performance.
The simplest interface would let the developer set limits on the worst case and avg. case performance, and then let the system try to achieve that in the way that minimizes wasted effort, logging detections of failure due to load or other conditions. A thread-based library could make running estimates of the distribution of time slices using low resources and implement that thread based solution efficiently if the margins are comfortable. In the resolution is too poor, it could have the ability to lanuch or contact a running setuid timer process that could try to adjust system priorities in a way that gave better chances for timing satisfaction. Or else the developer could tell management to upgrade hardware to meet specs.
-
AuthorPosts
You must be logged in to reply to this topic.