Go GC visualized

7f408bc67dc9ae3b288ee92d16d3c4c2?s=47 Deepu K Sasidharan
February 14, 2020
15k

Go GC visualized

7f408bc67dc9ae3b288ee92d16d3c4c2?s=128

Deepu K Sasidharan

February 14, 2020
Tweet

Transcript

  1. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Mark Setup G2 P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) = Write barrier on = Paused = Running
  2. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Mark Setup P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running Goroutine paused
  3. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Mark Setup P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running Write barrier enabled
  4. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running Marking started
  5. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  6. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  7. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  8. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  9. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  10. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  11. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark finished as noscan span reached = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  12. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark started for next GC root = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  13. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark finished as object has no pointer = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  14. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark start for next GC root = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  15. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  16. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  17. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  18. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark finished as noscan span reached = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  19. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark start for next grey object = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  20. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark finished as noscan span reached = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  21. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark start for next grey object = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  22. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  23. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack No more pointers = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  24. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Write barrier updates a pointer change = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  25. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark start for next grey object = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  26. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack No more pointers = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  27. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark start for next grey object = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  28. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Mark finished as noscan span reached = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  29. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Marking P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack All Grey objects are scanned and all white object can be collected = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  30. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Mark Terminate P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Goroutine paused = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial
  31. P1 M Processor Core P = Logical Processor per Hardware

    Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache mheap mspan mspan mspan mspan mspan mspan Stack = Write barrier on = Paused = Running = noscan mspan = GC Root = Alive = Unknown/Dead = Partial GC - Mark Terminate P1 M G2 Processor Core P = Logical Processor per Hardware Thread M = Machine per OS Thread G = Goroutine (Coroutine) mcache Stack Write barrier disabled = Write barrier on = Paused = Running = GC Root = Alive = Unknown/Dead = Partial