[systemd-devel] idle daemon sleep
Mantas Mikulėnas
grawity at gmail.com
Tue Dec 30 23:32:07 PST 2014
On Wed, Dec 31, 2014 at 8:37 AM, Alexandre Detiste
<alexandre.detiste at gmail.com> wrote:
> Le mercredi 31 décembre 2014, 08:23:51 Mantas Mikulėnas a écrit :
>> Even for .timer units, systemd simply sleeps until it's actually time
>> for the next event – like cron, or Task Scheduler for that matter.
>> There shouldn't be any "is it time yet?".
>
> In fact, many people complain that cron does wakes up their laptop every minute;
> and that increase battery consumption, while systemd timers doesn't suffer from this.
>
> http://unixhelp.ed.ac.uk/CGI/man-cgi?crond
> [ Additionally, cron checks each minute to see if its spool directory's
> [ modtime (or the modtime on /etc/crontab) has changed
>
> http://content.hccfl.edu/pollock/unix/crontab.htm
> [ Each minute the cron daemon wakes up and compares the crontab file entries against the current time.
> [ If the five fields match the current minute then the command is executed.
The original cron stopped doing this *in 1977* – at least according to
the history article [1], it learned to sleep exactly right until the
next event and re-read the crontab only every *30 minutes*.
But I took a look at vixie-cron on Debian 6, and yes, it wakes up to
stat() all crontabs to check for updates. Which makes the fancy event
list algorithm moot :( Meanwhile, Arch's default 'cronie' is more
modern and uses inotify.
[1]: https://en.wikipedia.org/wiki/Cron#History
--
Mantas Mikulėnas <grawity at gmail.com>
More information about the systemd-devel
mailing list