Implement burst(max_n) for UPCXX_MPSC_QUEUE_BIGLOCK
As described in pull request #312, the UPCXX_MPSC_QUEUE_BIGLOCK implementation of LPC queues (which is off by default and should only be used for debugging runtime correctness problems) lacks a proper implementation of intru_queue<T, intru_queue_safety::mpsc>::burst(max_n, fn)
.
The best fix (and IMO the only efficient one) is probably to add an operation to intru_queue<T, intru_queue_safety::none>
aka unsafe_queue
. I see at least two possibilities:
- A factory operation to "split" an
unsafe_queue
by dequeing up tomax_n
entries from a source to construct the temporary queue used inburst
, or - A "merge" operation that can take the items remaining in the temporary queue after
burst
and push them onto the front/HEAD of the source queue (maintaining FIFO ordering for fairness reasons).
Approach 1 extends the biglock critical section while traversing up to O(max_n)
entries (globally reducing concurrency of the LPC queues), Approach 2 requires re-acquiring the mutex when the burst would exceed max_n
, but otherwise has constant complexity.
This is low priority, because nobody should be using this unsupported option for production runs.