30

I've heard the term "Tickless OS" thrown around.

  • What does it mean?
  • Which OSes are tickless?
  • How does it differ from a non-tickless (tickful?) OS?
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319

4 Answers4

33

A 'tick' in OS terms is an interval after which the OS will wake up to process any pending events.

So, if you have a 100Hz tick, then 100 times a second, the OS will wake up, check to see whether any timers have expired, execute their actions if there are, then go to sleep again. On a tick-less system, rather than waking up 100 times a second to see if anything is ready to process, the OS will look at when the next timer is due to expire and then sleep until that time.

Note that when the CPU is active, it's obviously not going to go into any kind of sleep mode, and the kernel will set up an interrupt for scheduling purposes. It's only tickless (as the comment points out) when there's nothing running on the CPU or (in very modern Linux kernels) when only one process is running.

Linux can run with or without ticks, with a compile-time switch. I don't know about any other systems.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95
  • 2
    That is actually false. I thought tickless meant that at first too. However tickless kernels does not exist today. They are "full dynamic ticks" which only means that their periodic timer deactivates when there is 0 or 1 task running, but it still very much exists the rest of the time. (between kernel 2.16.18 and 3.0.x, the NO_HZ option deactivated the tick only when 0 task are running, 3.1 is full dyn.) – v.oddou Nov 26 '13 at 01:46
  • @v.oddou, I've added some clarifying text. I was trying to talk about the case where there were no processes executing but it wasn't very clear. – Andrew Aylett Nov 26 '13 at 15:15
  • ok good clarification. About other systems : I heard that Windows 8 was "tickless", I didn't read the book about internals so I am not sure if MS implementation of "tickless" means the same than for linux. – v.oddou Nov 27 '13 at 08:29
  • 2
    @v.oddou: Note that the ticks *have* to exist at other times because (a) the OS has no idea when a program might demand to know the current time, and (b) when a program does so, it has to be able to get a rough estimate extremely efficiently (like in a memory access). This means the OS essentially *has* to update a given memory location periodically to let the program read it quickly; otherwise querying the current time would become very inefficient. – user541686 Jun 13 '18 at 13:01
  • It's kind of similar to polling and interrupting. Or busy checking and event driven. – smwikipedia Nov 28 '21 at 02:40
  • @user541686, another interrupt free timekeeping approach is to read-only MMU map a hardware timer into user space, then let the program read the timer itself. But this is quite uncommon. – rsaxvc Mar 09 '23 at 00:19
14

This link provides some insights: Avoiding Processor Wake-Ups Saves Power

A fragment from the above link,

In order to take best advantage of the low power states offered by the latest processors, the operating system has to allow the processor to stay in those states as much as possible. A long-standing feature of the Linux* operating system has been a timer tick that supports services like helping the operating system keep internal time and monitor CPU usage by various applications and processes.

While that timer tick is useful, it also has the unfortunate side effect of waking the processor when it is in a low power state as many as 1,000 times per second. In fact, under some circumstances, the tick can prevent the processor from entering the deep power-saving states at all. Clearly, this effect can have a dramatic negative impact on power usage by the system.

Community
  • 1
  • 1
Nick Dandoulakis
  • 42,588
  • 16
  • 104
  • 136
1

RIOT (based on Microkernel Architecture) have tickless scheduler in it. for more information please find below link: https://riot-os.org/api/group__core__sched.html

SH'
  • 186
  • 2
  • 10
0

"Tickless" or "tick-based" ("heart-beat") design of time control system not only affects power consumption and task scheduling but also affects resolution of any timers, delays, waits and etc.

If "tickless" the resolution is down to the resolution of the the hardware timer which is used to measure a "delay", plus some scheduler latency. Even in 8086 era the hardware resolution was down to few microseconds. In this design the hardware timer is set to measure a delay to nearest time controlled event, interrupts the CPU and scheduler awakes pending task.

In "heart-beat" solution the resolution is not better than +0...+1 "tick" which is currently in 1ms...15ms range.

Notice, it has no much to do with "stop interrupts when processor is asleep" or "dynamically adjust timer frequency". The "tickles" timing system in OS is very different design, while manipulating interrupts frequency is still a good old "heart-beat" with all negatives and positives.

TomSzt
  • 1