0

I keep on with fork/join optimization, (or to be more precise with optimization of dividing input between threads). And faced the next statement (pg. 73):

Final parallelism speedup depends on:

  • Number of source elements (know value)
  • Cost of operation (almost impossible to estimate)
  • Available HW parallelism (possible to estimate)
  • Number of concurrent clients (we can somehow cope with it)

Question: What does it mean: available HW parallelism? How to estimate available HW parallelism?

Community
  • 1
  • 1
VB_
  • 45,112
  • 42
  • 145
  • 293
  • 1
    Number of processors and number of cores per processor, assuming JVM is capable of taking advantage of them all. – PM 77-1 Jun 14 '14 at 21:21
  • 1
    [Runtime::availableProcessors](http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors--) – nosid Jun 14 '14 at 21:21
  • Dr. Heinz M. Kabutz did a [newsletter](http://www.javaspecialists.eu/archive/Issue220.html) on this recently. – OldCurmudgeon Jun 14 '14 at 21:55

1 Answers1

2

hardware parallelism denotes a broader concept and means how many computing or I/O resources you have available to do parallel operations.

For computing resources, this may be the available CPUs on your system. However that is only an exact measure, when your JVM is on a non virtualized, uniform multi core system. In reality available processors may be shared in a virtual environment, may not have the same feature set, may be multi threaded, or share memory interfaces (NUMA).

For I/O resources it means the storage subsystem and how many requests it can do in parallel (e.g. the number of harddisks), plus, the I/O channel bandwidth.

For estimating your available "hardware parallelism" it is important to know which is the limiting factor for your workload. If I/O is not the problem, the task is called CPU bound or I/O bound otherwise. See my answer on Choosing optimal number of Threads for parallel processing of data. In this answer I also proposed the idea of using an adaptive algorithm to chose the number of threads.

Community
  • 1
  • 1
cruftex
  • 5,545
  • 2
  • 20
  • 36
  • can you explain `maxThreadCount - 1` and `new LinkedBlockingDeque<>(maxThreadCount * 2)` parameters please? How can I move those params to `ForkJoinPool`? – VB_ Jun 15 '14 at 12:26
  • Just edited the answer in the linked question to make my intentions clear. – cruftex Jun 15 '14 at 16:59
  • I have no experience `with ForkJoinPool`, but I think, by looking at the documentation, you can just use the available processor count. There are no "tricks" needed. – cruftex Jun 15 '14 at 17:17
  • and let's not forget, with the introduction of lots of computing resources, we become cache-limited quickly – Ralf H Jun 15 '14 at 22:19