Add support for multi-priority workqueues

Each piece of queued work now has an associated priority value; each
priority goes on a separate queue.

With probability (N-1)/N, the workers will take work from the highest
priority nonempty queue.  Otherwise, they'll look for work in a
queue of lower priority.  This behavior is meant to prevent
starvation for lower-priority tasks.
This commit is contained in:
Nick Mathewson
2017-07-12 11:47:01 -04:00
parent 5636b160d4
commit 10e0bff4ca
4 changed files with 126 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
o Minor features (relay, thread pool):
- Allow background work to be queued with different priorities, so
that a big pile of slow low-priority jobs will not starve out
higher priority jobs. This lays the groundwork for a fix for bug
22883.