Is there a queue of pending tasks used in conjunction with Java 8's Executors.newWorkStealingPool()?
For example, suppose the # available cores is 2, and Executors.newWorkStealingPool() is empty because 2 tasks are already running. Then what happens if a 3rd task is submitted to the work-stealing executor? Is it queued? And if it is, what are the bounds if any on said queue?
Thanks in advance.
Yes, every thread is backed with it's own deque. When one thread is done with it's tasks it takes task from other thread's deque and executes it.
Maximum size for the queues is limited by the number:
static final int MAXIMUM_QUEUE_CAPACITY = 1 << 26; // 64MWhen the queue is full an unchecked exception is thrown:
RejectedExecutionException("Queue capacity exceeded")