Turbo Charge CPU Utilization in Fork/Join Using the ManagedBlocker
summary
Shows that using Fork/Join plus a ManagedBlocker and a reserved-cache pattern cuts wasted CPU and speeds a big-integer Fibonacci run from ~46s down to ~7s, and then to ~6.9s when using managed blocking. Implements a putIfAbsent reserved placeholder to avoid duplicate work, rewrites parts of BigInteger multiply/square as forked tasks to parallelize Karatsuba/Tom Cook, and compares behavior with CompletableFuture and the common ForkJoinPool; code and exercises live on the linked GitHub.
AI-written summary · about
chapters (11)
- 0:00Introduction and CPU utilization
- 1:03Clock speed limits and parallelism
- 2:31Fibonacci series algorithm
- 7:09Demo 1: Single-threaded Fibonacci
- 11:07Demo 2: Fork/Join parallelism
- 16:19Demo 3: Hacking BigInteger
- 24:06Demo 4: Caching results
- 31:49Demo 5: Placeholder objects
- 37:16ManagedBlocker explained
- 43:00Demo 6: Using ManagedBlocker
- 45:14CompletableFuture and homework
