The operation of the Go garbage collector is based on the tricolor algorithm.
Strictly speaking, the official name for the algorithm used in Go is the tricolor mark-and-sweep algorithm. It can work concurrently with the program and uses a write barrier. This means that when a Go program runs, the Go scheduler is responsible for the scheduling of the application and the garbage collector. This is as if the Go scheduler has to deal with a regular application with multiple goroutines! You will learn more about goroutines and the Go scheduler in Chapter 9, Concurrency in Go – Goroutines, Channels, and Pipelines ...