Submit #1699

Updated by tuxillo about 5 years ago


It has been suggested that one of the steps towards a proper tickless kernel

would be the conversion of all the users of the various timeout API

to the use of the more rounded time units whenever possible, e.g. the

less precise and more rounded seconds instead of the more precise ticks. [0]

In the kernel, the most obvious and popular examples of such API

would be callout(9) and tsleep(9).

Since many current users of these API logically require an ms-based timer,

and the future granularity of a tick may be subject to change, it also

makes sense to introduce a millisecond (_ms) version of the API together with

the second (_s) addition.

It may be noted that OpenBSD already has had similar functions introduced

sometime in 2008 ([1], [2]): timeout_add_{tv,ts,bt,sec,msec,usec,nsec}.

Apart from _sec and _msec, the rest have no users (only _usec is used once),

and in the current environment, the us and ns timeouts would appear to serve

no purpose other than to mislead and confuse the developer.

On the other hand, timeout_add_sec is referenced in 142 kernel source files

in OpenBSD 4.7 as of 2010-03, and timeout_add_msec -- in 79.

Also, the standard SI abbreviation for second and millisecond

is s and ms, respectively, not sec and msec.

I think it may actually be reasonable to introduce a decisecond (ds)

version of the functions (in addition to the second and millisecond),

since that's what many millisecond-to-be users actually need, and _ds

would be more tickless-friendly compared to _ms anyways.

The centisecond (cs) may be considered as a more distant option. :-)

Please let me know what you think of these additions, and whether

similar _s and _ms sleep(9) functions should be added as well.

I'm also interested in the feedback regarding the potential _ds


Best regards,


[0] "Getting maximum mileage out of tickless" (2007)

[1] "timeout_add_{tv,ts,bt,sec,usec,nsec}" (2008-07-11)

[2] "timeout_add_msec" (2008-10-22)