title: Difference between CPU threads, Kernel threads, OS threads, user threads
body: <p>I've been reading a lot about how parallelism is different than concurrency, but I'm having a lot of questions like how can I achieve a parallelism with a programming language like Java?</p>
  
  <p>What I understood so far is with a VM like Java we can only achieve concurrency and parallelism is not in scope of JVM, it's threads mapped to  ( I'm confused here ) OS threads or Kernel threads?</p>
  
  <p>To understand the multi-threading one needs to understand how the threads of a VM ( JVM ) or a process are actually mapped down to the CPU hardware. Please help here.</p>
  
  <p>Correct me if I'm wrong, here are few things I think I understand right:</p>
  
  <p><strong>1. CPU threads</strong> ( Intel hyper-threading ): Hardware threads provided by adding more registers in CPU having same ALU, so do not actually behave as a dual-CPU ( if 2 threads are there in CPU ) and a "just"-concurrent use of ALU can just mask ( hide by an interleaved MUXing ) a principal inability to deliver indeed a true parallel code-execution.  </p>
  
  <p><strong>2. Kernel threads</strong>: Started by Kernel and these can be more in number than CPU threads but are a bit expensive to start.  </p>
  
  <p><strong>3. OS threads</strong>: I don't understand it.  I'm guessing this is what you mean when you call native threads and probably same as previous #2 ie Kernel threads.</p>
  
  <p><strong>4. User threads</strong>: Just like <code>new Thread()</code> in JVM or .NET. I think they are not recognized as threads by OS so nothing much can be done here from the parallelism perspective. </p>
  
  <p>I need to understand how threads created in #4 are mapped to #1, may be with examples to Windows/Linux/MacOS.</p>
  
  <p>Guys, I understand how wide this question can be but I can live with brief info and link to any detailed documentation. Thanks in advance.</p>