What's the difference between cms and g1 garbage collector which makes g1 better?
Most of places it is said that this is because in G1, heap is divided into regions and then collection of regions are marked as young/old generation and gc runs on few regions and not on whole heap. I am trying to further understand this and have few more questions:
When young gc runs (which is stop the world) it runs on all the young generation regions which implies whole of young part of heap and not few regions of young generation. Then is it identical to CMS in terms of time it takes ?
Incremental compaction - Mixed collections - Now this is where i think G1 has advantage because concurrent marking of whole heap keeps on happening and there are mixed gc cycles which runs on all young regions + few old regions (with most garbage first). So it keeps on removing garbage from old generation as well instead of waiting for Full gc to happen. Is it correct ?
Are the above stated points correct ? And what are other differences which makes g1 better ?