title: Difference between processors and threads
body: <p>I am using parallel stream of java 8, but I don't understand one thing:</p>
  
  <p>I have a machine with 8 processors...</p>
  
  <pre><code>IntStream.range(0, 9).parallel().forEach(i -&gt; {
      int cnt = 0;
      while (System.currentTimeMillis() &lt; runUntil)
          cnt++;
      System.out.println(i + ": " + cnt);
  })
  </code></pre>
  
  <p>Does this mean I can only use 8 threads? </p>
  
  <p>The above code runs 8 in parallel and next will be waiting, but if I use a custom thread pool using <code>ForkJoinPool</code> tasks more than 8 will be running in parallel.</p>
  
  <pre><code>ForkJoinPool forkJoinPool = new ForkJoinPool(17);
  forkJoinPool.submit(()-&gt;IntStream.range(0, 17).parallel().forEach(i -&gt;
  {
      int cnt = 0;
      while(System.currentTimeMillis() &lt; runUntil)
          cnt++;
      System.out.println(i + ": " + cnt);
  })).get();
  </code></pre>
  
  <p>The above code runs only 16 in parallel. If I can use more than 8 threads in 8 processor machine, what is the max number of threads I can use. </p>
  
  <p>Edit 1-Does this mean the max number of threads we can use is 2*available processor's?</p>