Modern Java in Action 8 - concurrency and reactive programming
Task appropriate for the job
- high parallelization : use fork-join pool and and parallel streams for highly CPU-bound calculations
- high interactivity: high concurrency and a need to keep a lot of IO-bound tasks on single CPU: use Future (Completable Future) or Flow API
Problems and solutions
Threads problems
- map 1:1 to OS threads (expensive to create and of limited number)
- much higher number than hardware threads (cores? well, it seems a core is more complex)
CPUs like the Intel i7-6900K have multiple hardware threads per core, so the CPU can execute useful instructions even for short delays such as a cache miss.










