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

Danny Mayer mayer at ntp.isc.org
Sun Feb 15 01:45:09 UTC 2009


Harlan Stenn wrote:
>> ... 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.
> 
> History is why ntpd does not do it by default for Unix.
> 
> I was not involved in these decisions for Windows so I have no idea why
> the decision there was different.

Me neither. I think it was before my time.

> 
>> 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.
> 
> There *might* be a good reason that -N is handled different for
> Windows.  I just don't know what it is.
> 
>> 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).
> 
> Is this something that can be addressed by the startup file?  I'm
> assuming most folks will either use the included service startup file
> then we can fix it there, and if not perhaps we could either provide
> something in the distribution (we may be doing this already) or document
> it.
> 

Services work a bit differently from Unix. While it's like a startup
file it isn't exactly. It is in the plans to get the command line
options into a registry entry (separate from the startup entry. That way
it will be more amenable to changes.

> I'd like to hear from the usual Windows folks about this, and any other
> Windows folks who care to express an opinion.
> 

I can be added by the installer to the startup entry in the services
registry entry but I would prefer to keep it separate.

>> 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.
> 
> I care about and dislike the "difference" but I'm not sure I care enough
> to change the status quo.
> 

This can be handled by the installers.

Danny



More information about the hackers mailing list