title: Why multiple garbage collectors in Java?
body: <p>Every Java process I start on my machine seems to have two garbage collectors by default. I'm checking this via JConsole.</p>
  
  <p>Example - for my currently running Eclipse.</p>
  
  <h3>PS MarkSweep</h3>
  
  <pre><code>Collection Count - 221
  Collection Time - 102118
  Memory Pool Names - java.lang.String[4]
  </code></pre>
  
  <h3>PS Scavenge</h3>
  
  <pre><code>Collection Count - 241
  Collection Time - 2428
  Memory Pool Names - java.lang.String[2]
  </code></pre>
  
  <p>I am assuming they have overlapping pools. How do two garbage collectors work together when using the same pools (Eden, survivor, old gen)? Is there no overlap in movement of objects between pools (like movement from one survivor to another when the second algorithm is called)? Even if it is not, why do we need more than one collector per pool?</p>
  
  <p>I have read <a href="http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html" rel="nofollow noreferrer">this article on GC</a>. They refer to using different collectors for different major and minor GC, but there seems to be no reference to using multiple collectors on the same pool.</p>