The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > 0 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β 1 π β π + 1 %π 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: 14
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > 0 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β 1 π β π + 1 %π 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list: Mutator interleaved!
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Marking Phase 0 1 Root: 1. Shade all roots. π is the π β 0 2. nodes count 3. π β π in the graph 2 3 4 While π > π 4. 14 1. < π β color of node # π > 5 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 9 10 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 5 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 Free list: Mutator interleaved!
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 9 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 10 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Marking Phase (2) 0 1 Root: 1. Shade all roots. π β 0 2. 3. π β π 2 3 4 While π > 0 4. 14 1. < π β color of node # π > 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 3. Else 1. π β π β 1 π β π + 1 %π 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Marking Phase (2) 0 1 Root: 1. Shade all roots. π β 0 2. 3. π β π 2 3 4 While π > 0 4. 14 1. < π β color of node # π > 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 3. Else 1. π β π β 1 π β π + 1 %π 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Marking Phase (2) 0 1 Root: 1. Shade all roots. π β 0 2. 3. π β π 2 3 4 While π > π 4. 14 1. < π β color of node # π > 6 7 2. If π == Gray then 1. βC1β: <Shade the successors of node # π and make node # π black> 8 3. Else 1. π β π β π π β π + π %π΅ 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase(2) 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 3 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list:
The Collector: The Appending Phase(2) 0 1 Root: 1. While π < π < π β color of node # π > 1. If π == WHITE then 2. 2 4 14 1. <Append node # π to the free list> 6 7 Else if π == BLACK then 3. <make node # π white> 1. 8 π + + 4. 11 12 13 Green simple atomic operations. We will try to break the red. 5 9 10 Free list: 3
Proof for Correction Criteria 2 β’ Reminder for CC2: βAppending a garbage node to the free list is the collectorβs only modification of the shape of data structureβ. β’ The marking phase doesnβt change the data structure. β’ Prove the rest by showing that the following invariant holds after the marking phase completes: β βA white node with a number β₯ π is garbageβ
Proof for Correction Criteria 2 β cont β β’ For the first iteration ( π = 0 ), this derives from the following observations: β’ The marking phase terminates when there is no gray node. β’ The absence of gray nodes is stable once reached. β’ At the end of the appending phase, there is no black nodes.
Proof for Correction Criteria 2 β cont β β’ For the other iterations ( π > 0 ), this derives from the following observations: β There are 2 ways to violate the invariance: β’ Making a non-garbage node white. β’ Making a (white) garbage node into non-garbage. β The mutator β’ doesnβt convert nodes to white. β’ donβt deal with to white garbage nodes. β The collector β’ For the π -th iteration, only the π -th node may change the color.
Proof for Correction Criteria 1 β’ Reminder for CC1: βEvery garbage node is eventually appended to the free listβ. β’ First we need to prove that both phases terminates correctly. β The marking phase terminates because the quantity π + π΅ β π , where π is non-black nodes, decreases by at least 1 for each iteration. β The appending phase terminate obviously, and the mutator cannot change the color of the nodes.
Proof for Correction Criteria 1 β cont β β’ At the beginning of the appending phase, the nodes can be partitioned into 3 sets: β The set of reachable nodes β’ They are black β The set of white garbage nodes β’ Will be appended to the free list in the first appending phase to come β The set of black garbage node β’ Will be appended to the free list in the next appending phase to come
THE SECOND COARSE-GRAINED SOLUTION
The BUGGY Proposal β’ An attempt to break M1 into 2 atomic operations: β <Redirect an outgoing edge of a reachable node towards an already reachable one> β <Shade the new target> β’ Shading must be the first in order to keep P1! β’ A bug was found by Stenning & Woodger.
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Appending Phase first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Demo 0 Root: β’ An attempt to break M1 into 2 atomic 2 operations: β <Redirect an outgoing edge of a reachable 1 Free list: 3 node towards an already reachable one> A Reachable Node in The Free List! β <Shade the new target> β’ Shading must be the Collector β Appending Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Appending Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> P1 is now violated!!! β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> P1 is now violated!!! β <Shade the new target> β’ Shading must be the Mutator first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 1 2 operations: β <Redirect an outgoing edge of a reachable Free list: 3 node towards an already reachable one> P1 is now violated!!! β <Shade the new target> β’ Shading must be the Collector β Marking Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 2 operations: β <Redirect an outgoing edge of a reachable 1 Free list: 3 node towards an already reachable one> P1 is now violated!!! β <Shade the new target> β’ Shading must be the Collector β Appending Phase first in order to keep P1!
The BUGGY Proposal - Reply 0 Root: β’ An attempt to break M1 into 2 atomic 2 operations: β <Redirect an outgoing The new idea β replacing the edge of a reachable 1 Free list: 3 node towards an already invariant P1 by weaker invariants. reachable one> P1 is now violated!!! β <Shade the new target> β’ Shading must be the Collector β Appending Phase first in order to keep P1!
New Invariant: P2 0 1 Root: β’ Propagation path: A path of consisting solely 2 3 4 of edges with white targets, and starting 5 6 7 from a gray node. β’ P2: βFor each white 8 9 10 reachable node, there exists a propagation 11 12 13 path leading to itβ Free list: 14
New Invariant: P3 β’ P3: βOnly the last edge placed by the mutator may lead from a black node to a white oneβ
The New Algorithm 0 1 β’ The collector remains Root: the same! β’ The mutatorβs new 2 3 4 operation is the 5 6 7 following M2: β <Shade the target of the 8 9 10 previously redirected edge, and redirect an outgoing edge of a 11 12 13 reachable node towards a reachable node> Free list: 14
The New Algorithm 0 1 β’ The collector remains Root: the same! β’ The mutatorβs new 2 3 4 14 operation is the 5 6 7 following M2: β <Shade the target of the 8 9 10 previously redirected edge, and redirect an outgoing edge of a 11 12 13 reachable node towards a reachable node> Free list: Mutator interleaved!
Recommend
More recommend