Upgrade to Pro — share decks privately, control downloads, hide ads and more …

introduction-to-modern-gc

 introduction-to-modern-gc

Shenandoah GC・ZGC・Epsilon GCをざっくり理解したい!

JJUG CCC 2018 Spring での発表資料です

tomoya yokota

May 26, 2018
Tweet

More Decks by tomoya yokota

Other Decks in Technology

Transcript

  1. GCͱΞϓϦఀࢭ(STW) Compaction GC Parallel GC young gc old gc GC

    = ΞϓϦέʔγϣϯεϨουఀࢭ ϝϞϦ͕ϑϥάϝϯτ͠ͳ͍ CPUෛՙ͸খ͍͞ Stop The world = ΞϓϦέʔγϣϯεϨουͷఀࢭ Mark Compaction GC Noop
  2. GCͱΞϓϦఀࢭ(STW) CMS GC Compaction GC young gc marking sweep GC

    old gc initial-mark final-remark young gc͸ΞϓϦέʔγϣϯεϨουఀࢭ major gc͸΄΅ฒྻ ϝϞϦͷϑϥάϝϯτ͕ܽ఺ Stop The world = ΞϓϦέʔγϣϯεϨουͷఀࢭ Concurrent = ΞϓϦέʔγϣϯεϨουͱฒྻ
  3. GCͱΞϓϦఀࢭ(STW) G1GC Compaction GC young gc Marking old gc initial-mark

    final-remark young gc͸ΞϓϦέʔγϣϯεϨουఀࢭ major gc͸໨ඪఀࢭ࣌ؒΛݩʹGCΛߦ͏ ϝϞϦ͕ϑϥάϝϯτ͠ͳ͍ Stop The world = ΞϓϦέʔγϣϯεϨουͷఀࢭ Compaction GC Concurrent = ΞϓϦέʔγϣϯεϨουͱฒྻ
  4. GCͱΞϓϦఀࢭ(STW) Parallel GC CMS GC G1GC young gc Concurrent mark

    Concurrent sweep Mark Concurrent mark old gc Compaction GC Compaction GC Compaction GC Compaction GC Compaction GC Noop
  5. ฒྻίϯύΫγϣϯͷ໰୊఺ Pointer x = 1 y = 2 z= 3

    Pointer x = 1 y= 2 z= 3 GCεϨου͕Ҡಈத • GCεϨου͕ΦϒδΣΫτͷҠಈதʹ
 ϦϑΝϨϯεͷॻ͖׵͕͑ى͖ΔՄೳੑ Ͳ͕ͬͪຊ෺ʁ
  6. Brooks pointer Pointer Header x = 1 y = 2

    z= 3 Pointer Header x = 1 y= 2 z= 3 ࢀরઌ͕ίϯύΫγϣϯ͞Εͨݹ͍ΦϒδΣΫτͳΒ ϔομʔΛͨͲͬͯɺ৽͍͠ΦϒδΣΫτΛࢀর͢Δ
  7. GCશମΛͳ͕ΊͯΈΔ Initial Mark Final Remark Concurrent Mark Concurrent Compaction update

    Reference Concurrent update Reference final update Reference Application work Application work Application work ฒྻίϯύΫγϣϯͷ͓͔͛Ͱ
 ίϯύΫγϣϯ࣌ͷSTWΛͳͭͭ͘͠
 ϑϥάϝϯτΛ๷͙͜ͱ͕Ͱ͖ΔΑ͏ʹͳͬͨ Stop the world
  8. ZGC

  9. ΦϒδΣΫτͷΞυϨεදݱ 42 bit ࠷େ4TBͷΞυϨεΛදݱͰ͖Δ 4 1 17 bit ະ࢖༻ ΧϥʔϙΠϯλΛදݱ

    1. 64bitͷΞυϨεۭؒશ෦࢖͏ 2. ώʔϓΞυϨε͸ԼҐ42bitΛར༻ 3. 4bitͰΧϥʔϙΠϯλͷ৭Λදݱ
  10. 64bitΞυϨεΛ࠷େݶར༻ Heap(4TB) marked0 marked1 remapped 0x0000040000000000 0x0000000000000000 0x0000080000000000 0x00000C0000000000 0x0000100000000000

    0x0000140000000000 0x000010001234abcdef 1. ΦϒδΣΫτ͸଴ආࡁΈ 2. 001234abcdefʹ࣮ମ ZGCͰ͸64bitͷΞυϨεΛ࢖͏.ϝϞϦ͕128TBඞཁ
  11. GCશମΛͳ͕ΊͯΈΔ ark Final Remark oncurrent Mark Concurrent Compaction pplication work

    Application work Initial Mark Final Remark Concurrent Mark/Remap Concurrent Compaction Application work Application work GC1प໨ GC2प໨