It won't go on forever. The formal proofs are in the original Sapphire and distributed Train algorithm papers. Informally the proofs show that there is no way to create a new white object, no way to pass white object between threads more than a bounded number of times, reachable non-black objects are bounded, and each loop discovers and extinguishes at least one non-black reachable object.
Richard L. Hudson and J. Eliot B. Moss, ``Sapphire: Copying GC Without Stopping the World,'' *Concurrency and Computation: Practice and Experience*, Volume 15, Issue 3-5, pp. 223-261, John Wiley and Sons, 2003. *http://dx.doi.org/10.1002/cpe.712 <http://dx.doi.org/10.1002/cpe.712>*. On Monday, June 7, 2021 at 6:00:11 PM UTC-4 Ian Lance Taylor wrote: > On Sun, Jun 6, 2021 at 4:19 AM xie cui <[email protected]> wrote: > > > > https://github.com/golang/go/blob/master/src/runtime/mgc.go#L858-L876 > > due to these code lines, stw in one gc cycle may happen more than 2 > times. so stw times in one gc cycle could be 2(general), 3, 4, .... and > even for ever? > > Theoretically, yes. In practice, this is not a problem. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/29b00794-d452-4706-8cf4-45570bddad13n%40googlegroups.com.
