Thread priorities
Hal Murray
halmurray at sonic.net
Wed Mar 5 04:00:13 UTC 2025
I've been trying to cleanup the thread priorities. So far, all I have is
a sore head.
The root of the problem is that we are creating the threads after dropping
root. You might think that it would be OK to reduce your priority, but it
doesn't work that way.
pthread_create() has an option to set the scheduling info on the new
thread. It seems to ignore my attempts without complaining.
Linux has CAP_SYS_NICE. We could keep that when dropping root. (We
already keep a few others so it would be a trivial edit.) But I want
something hat works on BSD too.
I tried nice(). Linux documents it as working per-thread and ok to reduce
your priority without CAP_SYS_NICE. It worked on Linux but not FreeBSD or
NetBSD.
My current plan is to create the threads before dropping root, park them
someplace safe, then wake them up when we are ready for them. The catch
with that is that the DNS path makes and destroys a new thread each time.
So I'll have to fix that first.
---------
Do we want to get a release out now or continue fixing/tweaking things?
--
These are my opinions. I hate spam.
More information about the devel
mailing list