Skip to content

docs: Issue write-ups for multi-victim steal chain and wakeFirstIdle ABA bias#121

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/sequential-chain-multi-victim
Draft

docs: Issue write-ups for multi-victim steal chain and wakeFirstIdle ABA bias#121
Copilot wants to merge 1 commit into
masterfrom
copilot/sequential-chain-multi-victim

Conversation

Copilot AI commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Two open design problems in the work-stealing algorithm need detailed analysis: (1) no burst-handling data at 8+ carriers with load imbalance, and (2) wakeFirstIdle lowest-ID bias creating an ABA pattern where one carrier absorbs all steal work.

Issue 1: Sequential chain for multi-victim steal (docs/issues/multi-victim-sequential-chain.md)

  • Explains Go's nmspinning approach: cap searchers at GOMAXPROCS/2, randomized victim start, steal-half semantics — all without per-P utilization measurement
  • Proposes analogous options: cap at clusterSize / 2, rotating start index, adaptive cap based on idle count
  • Key tension: with cluster size 4 and 2 carriers slow, the remaining 2 must both be available — soft limits at half-cores may be the ceiling

Issue 2: wakeFirstIdle lowest-ID bias and ABA (docs/issues/wakefirstidle-lowest-id-bias-aba.md)

  • Long.numberOfTrailingZeros(word) always selects lowest-ID idle carrier → carrier 0 is perpetually hot-pathed while others stay cold
  • Both bitmap (LIFO-like via scan order) and stack (LIFO by design) suffer the same ABA: carrier parks and immediately becomes next wake target
  • Argues against dual structures (bitmap + stack) due to atomicity/consistency overhead
  • Proposes single-structure solutions: rotating scan start, victim-ID-derived offset, bitmap+epoch for temporal ordering
// Current: always wakes lowest-ID idle carrier
int bit = Long.numberOfTrailingZeros(word);  // bias toward carrier 0

// Proposed (rotating scan):
int startWord = (scanCounter++ % words.length);  // distribute wake targets

These are issue drafts committed as docs — sandbox lacked permissions to create GitHub issues directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants