Why architecture matters here

FJP fails on wrong granularity, common pool starvation, and blocking without ManagedBlocker. Architecture matters because task shape decides parallelism.

Advertisement

The architecture: every piece explained

The top strip is basics. RecursiveTask / Action. Fork + split. Worker deques. Work stealing.

The middle row is knobs. Common pool. ManagedBlocker. Parallelism param. Streams parallel.

The lower rows are ops. Task granularity. Metrics. Ops — isolate + tune.

ForkJoinPool — work stealing + task splitting + parallelism + common poolrecursive parallel decompositionRecursiveTask / Actionunit of workFork + splitdivide + conquerWorker dequesper-threadWork stealingidle threads helpCommon poolshared defaultManagedBlockerfor blocking opsParallelism paramN-1 cores defaultStreams parallelbacked by FJPTask granularitynot too smallMetricssteal + queueOps — isolate common pool + tune parallelismsharemanagetunebacksizemeasuremeasureoperateoperate
ForkJoinPool with work stealing + worker deques.
Advertisement

End-to-end flow

End-to-end: parallel sum over 1M items. Split recursively down to 1k chunks. Workers steal tasks from busy deques. Total time N/parallelism + overhead.