HARDCLOCK(9)
β¨ HARDCLOCK(9) β¨
okay so bestie, welcome to the Kernel Developer's Manual β today's main character is hardclock, the real-time timer herself π
π NAME π
hardclock β real-time timer β°β¨
π¦ SYNOPSIS π¦
void
hardclock(int cnt, int usermode);
π DESCRIPTION π
So the hardclock() function gets called periodically, and the timing is lowkey based on how much pending work there is. Like, the rate ranges from hz times per second on a very busy system, all the way down to twice a second on an idle system. Slay, adaptive queen π.
The cnt argument reports an estimate of the number of ticks since the last call. Over long timescales, the average sum of cnt over one second is hz. Over shorter time scales though, definitely go check hz(9) for the important details β fr fr, it matters. π
The usermode argument is non-zero when hardclock() is called from a context that interrupted usermode execution.
Not me doing this many jobs at once β hardclock() may perform different tasks such as:
- Run the current process's virtual and profile time (decrease the corresponding timers, if they are activated, and generate
SIGVTALRMorSIGPROF, respectively). π - Increment the time-of-day, taking care of any
ntpd(8)oradjtime(2)induced changes and leap seconds, as well as any necessary compensations to keep in sync with PPS signals or external clocks, if supported by the kernel. πβ¨ - Schedule
softclockinterrupts (swi(9)) processing. - Collect
hwpmc(4)statistics. π - Do device polling, when enabled (see
polling(4)). - Implement
watchdog(9)processing. π - Enqueue
epoch(9)processing.
not a single boring task in the list, she ate and left absolutely no crumbs π
π SEE ALSO π
adjtime(2), ntp_adjtime(2), signal(3), hwpmc(4), polling(4), ntpd(8), epoch(9), eventtimers(9), hz(9), swi(9), watchdog(9)
go read them all, iykyk π«Ά
π sign-off π
this lil masterpiece came from Debian, dated February 27, 2023, and lives at the very bottom of the page as HARDCLOCK(9) β periodt. π§ββοΈπ«
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2001 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms