File:  [NetBSD Developer Wiki] / wikisrc / projects / project / tickless.mdwn
Revision 1.6: download - view: text, annotated - select for diffs
Tue Mar 1 10:38:49 2022 UTC (21 months, 1 week ago) by martin
Branches: MAIN
CVS tags: HEAD
Adapt open gsoc project suggestion to new gsoc rules, mark as 175/350h

[[!template id=project

title="Tickless NetBSD with high-resolution timers (350h)"

contact="""
[tech-kern](mailto:tech-kern@NetBSD.org)
"""

mentors="""
[Taylor R Campbell](mailto:riastradh@NetBSD.org)
"""

category="kernel"
difficulty="hard"
duration="350h"

description="""
NetBSD configures a timer device to deliver a periodic timer interrupt,
 usually every 10 ms, in order to count time, wake threads that are
 sleeping, etc.
This made sense when timer devices were expensive to program and CPUs
 ran at MHz.
But today, CPUs run at GHz; timers on modern x86, arm, mips,
 etc. hardware are cheap to reprogram; programs expect greater than
 10 ms resolution for sleep times; and mandatory periodic activity on
 idle machines wastes power.

There are four main milestones to this project:

1. Choose a data structure for high-resolution timers, and a way to
 request high-resolution vs low-resolution sleeps, and adapt the
 various timeout functions (`cv_timedwait`, etc.) to use it.
The current call wheel data structure for callouts provides good
 performance, but only for low-resolution sleeps.
We need another data structure that provides good performance for
 high-resolution sleeps without hurting the performance of the existing
 call wheel for existing applications.

2. Design a machine-independent high-resolution timer device API,
 implement it on a couple machines, and develop tests to confirm that
 it works.
This might be done by adapting the `struct timecounter` interface to
 arm it for an interrupt, or might be done another way.

3. Convert all the functions of the periodic 10 ms timer, `hardclock`,
 to schedule activity only when needed.

4. Convert the various software subsystems that rely on periodic timer
 interrupts every tick, or every second, via
 [[!template id=man name="callout" section="9"]],
 either to avoid periodic work altogether, or to batch it up only when
 the machine is about to go idle, in order to reduce the number of
 wakeups and thereby reduce power consumption.
"""
]]

[[!tag gsoc]]
[[!tag gsoc350h]]

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb