[ntp:hackers] ntpd -N is default on Windows...

Dave Hart davehart at davehart.com
Sat Feb 14 22:06:50 UTC 2009


... and I kind of wonder why it's not the default on all
platforms.  Without -N (or another option on some platforms)
ntpd doesn't attempt to raise its scheduling priority (or
lower, depending on how you look at things).  Except on
Windows.  On Windows, ntpd always attempts to raise itself
to realtime priority class, though if run as a non-admin
user that is silently downgraded by the OS to high priority
class.  There is no way on Windows to not attempt to raise
the priority.

This bit me because I tried to reduce some #ifdef forest in
ntpd.c by folding the Windows port into the BSD
setpriority() mold.  Except the code I removed didn't honor
priority_done while the setpriority() code did, so the
ntpd.exe that results works like on other platforms, namely,
running at default priority unless -N is given on the
command line.

So now we have the ugly situation where for no good reason
the Windows port is different than Unix, and has been for
ages undoubtedly.  If I proceed with the cleanup I've done,
Windows users can get bitten if they don't add -N to their
ntpd command line when moving to the new version.  I can and
have hacked it to default -N on Windows in the meantime, but
that leaves no way to run at normal priority on Windows (no
change).

I am having a hard time imagining when on a Windows machine
I might want to run ntpd at normal priority as an end user.
Sure, as a developer I might prefer to test changes at
normal priority so an infinite loop doesn't lock me out of
the machine, but once I'm confident it won't peg the CPU,
I'd want to at least run it at high priority, perhaps with a
realtime-priority cmd.exe standing by in case :)

I'm not a big Unix user but I'm having the same difficulty
imagining why an end user would ever invoke run ntpd without
-N.  I am not advocating changing defaults, mind you,
inertia counts for a lot.

Presumably -N should remain default/redundant/irreversible
on Windows to avoid a nasty surprise for users.  I don't see
any need to add an option to not raise priority on Windows,
either.

Cheers,
Dave Hart


More information about the hackers mailing list