Hiram,
I am trying to wrap my mind around hawtdispatch, and I have reached
the point where I think I need you to answer a question in order for
my understanding to progress.
I understand that hawtdispatch is indented to be a single system-wide
thread pool modeled after libdispatch, and I often encounter
statements to this effect. For example, here's a recent question on
stack overflow where you recently maintained that point:
http://stackoverflow.com/questions/9322252/how-is-hawtdispatch-different-from-javas-executors-and-netty
Similarly, the javadoc in Dispatch.java says: "All dispatch queues
use a shared fixed size thread pool to execute tasks".
However, when I explore the source code, it's hard for me to
understand how this is implemented. For example, I start by reading
the SimplePool.java source, and I notice that its constructor is
called from the constructor GlobalDispatchQueue.java, which is (in
turn) instantiated HawtDispatcher.java in the following two methods:
getGlobalQueue()
getGlobalQueue(DispatchPriority priority)
Since there are three different priorities, it seems like there would
be up to 3 instances of SimplePool that end up being created behind
the scenes.
Could you help me understand the apparent mismatch here? Are you
considering these 3 instances of SimplePool to collectively be the
single meta-pool that you refer to as the "shared" thread pool?
Also, I'm curious to what extent the three different DispatchPriority
levels depend upon Thread.MAX_PRIORITY, Thread.NORM_PRIORITY, and
Thread.MIN_PRIORITY. There's a pretty pessimistic article here that
makes it seem that I'd have to run my JVM as root and launch it with a
special flag in order for these thread priorities to mean anything on
Linux.
http://www.javamex.com/tutorials/threads/priority_what.shtml
Do you have any thoughts on that?