Distributed Garbage Collection for General Graphs Basic Approaches - - PowerPoint PPT Presentation

distributed garbage collection for general graphs basic
SMART_READER_LITE
LIVE PREVIEW

Distributed Garbage Collection for General Graphs Basic Approaches - - PowerPoint PPT Presentation

Distributed Garbage Collection for General Graphs Basic Approaches to Garbage Collection The Brownbridge Collector SWP Collector


slide-1
SLIDE 1

Distributed Garbage Collection for General Graphs

slide-2
SLIDE 2

Basic Approaches to Garbage Collection

slide-3
SLIDE 3

The Brownbridge Collector

slide-4
SLIDE 4

SWP Collector

○ ○

slide-5
SLIDE 5

Distributed Garbage Collection, The Problem...

○ ○

slide-6
SLIDE 6

Distributed Garbage Collection: Prior Work

slide-7
SLIDE 7

Introducing the SWPR Collection Algorithm

slide-8
SLIDE 8

SWP Collector, an Example

S S W W S S W S W W S S W The strong edge is removed Starting graph

slide-9
SLIDE 9

SWP Collector, an Example

P W S P S W Phantomization

  • ccurs

P S S P P S Phantomization spreads

slide-10
SLIDE 10

SWP Collector, an Example

P S S P P P … and spreads a final time P S S P P P These nodes have strong edges at the end

slide-11
SLIDE 11

SWP Collector, an Example

S S S W S P And so we rebuild their outgoing edges S S S W S W Rebuilding propagates, too And we’re done!

slide-12
SLIDE 12

SWP Collector: A Similar Example

W S S S W S W Starting graph W S P S P S As before, when we pull a strong edge away, the node toggles and phantomizes.

slide-13
SLIDE 13

SWP Collector: A Similar Example

S P P P P S S P P P P P Phantomization spreads, causing another node to toggle. Phantomization spreads to the last node. All nodes phantomized. The initial node has all incoming phantom edges.

slide-14
SLIDE 14

SWP Collector: A Similar Example

S P P P P P ? S S P S P P We cannot rebuild the graph from the initial node. We can, however, “recover” from one

  • f the other nodes in the graph

because it has a strong edge.

slide-15
SLIDE 15

SWP Collector: A Similar Example

S S W S W W The recovery spreads, and all the edges of the graph are rebuilt. The Phases of Collection:

  • Phantomization
  • Build - If the initiator has a strong edge
  • Recover - If the initiator does not have a

strong edge. Recover can lead to building.

  • Delete - If Recover fails.
slide-16
SLIDE 16

SWP Collector, Collecting a Simple Cycle

S S W P S P P P P A simple cycle Remove the incoming edge, Convert incoming edge and phantomize. Phantomization spreads Everything is phantomized. Recovery fails. The cycle is garbage.

slide-17
SLIDE 17

SWP Collector: One Last Example

S S S S S S S S W S P S S S S S S W S S S S S S This kind of graph stabilizes quickly!

slide-18
SLIDE 18

The Multi-Collection Algorithm

slide-19
SLIDE 19

Does it work?

○ ○ ○ ○

slide-20
SLIDE 20

Details

slide-21
SLIDE 21

Performance

slide-22
SLIDE 22

Performance

slide-23
SLIDE 23

Performance

slide-24
SLIDE 24

Thanks!

slide-25
SLIDE 25

Appendix

slide-26
SLIDE 26

Collecting With SWPR

Reference counts are written like this: [2,1,0], it means strong count=2, weak count=1, phantom count=0. Weights are written like this (2/3), it means weight=2, max weight=3. [1,0,0] (3/2) [1,1,0] (2/3) [1,0,0] (1/2) [1,0,0] (3/2)

slide-27
SLIDE 27

Collecting With SWPR

We now delete one of the edges. The central node now has strong count=0, and weak count=1. This violates our requirement that all nodes have strong support. [1,0,0] (3/2) [1,1,0] (2/3) [1,0,0] (1/2) [1,0,0] (3/2)

slide-28
SLIDE 28

Collecting With SWPR

The central node toggles, increasing its weight so that its weak edges become strong. It now phantomizes, sending phantomize messages along its outgoing edges. It sets its wait count to 3. The node will take no further action until wait=0. This central node is called the “initiator” and it coordintes the collection. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [1,0,0] (3/2) Phantomize

slide-29
SLIDE 29

Collecting With SWPR

When phantomize reaches the node on the right, its strong edge is converted to phantom. Because it loses strong support, it, too, phantomizes. Note that it remembers the node it must send Return to after phantomization with a parent edge (dashed arrow). All nodes have storage for a single parent edge. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [0,0,1] (3/4) wait=1 Phantomize

slide-30
SLIDE 30

Collecting With SWPR

Eventually, a return message comes back to the node on the right. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [0,0,1] (3/4) wait=1 Return

slide-31
SLIDE 31

Collecting With SWPR

It’s wait count is now zero, so it sends return to its parent and unsets the parent edge. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [0,0,1] (3/4) wait=0 Return

slide-32
SLIDE 32

Collecting With SWPR

The wait count on the central node drops to 2. That’s not zero, so it doesn’t do anything. [1,0,0] (3/2) [1,0,0] (4/3) wait=2 [1,0,0] (1/2) [0,0,1] (3/4) wait=0

slide-33
SLIDE 33

Collecting With SWPR

Finally, the other return messages come back. [1,0,0] (3/2) [1,0,0] (4/3) wait=2 [1,0,0] (1/2) [0,0,1] (3/4) wait=0 Return

slide-34
SLIDE 34

Collecting With SWPR

The wait count is now zero, so an action can be taken... [1,0,0] (3/2) [1,0,0] (4/3) wait=0 [1,0,0] (1/2) [0,0,1] (3/4) wait=0

slide-35
SLIDE 35

Collecting With SWPR

Because our strong count is positive, the next action is to build, i.e. to clear the phantomized

  • state. Note that this increases the wait count back to 3.

[1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [0,0,1] (3/4) wait=0 Build

slide-36
SLIDE 36

Collecting With SWPR

The node on the right now has a weight of 5 and a max weight of 4. Accordingly, it sets its strong count to 1, its phantom count to zero, and propagates the build message. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [1,0,0] (5/4) wait=1 Build

slide-37
SLIDE 37

Collecting With SWPR

The build message returns. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [1,0,0] (5/4) wait=1 Return

slide-38
SLIDE 38

Collecting With SWPR

The node on the right now has a wait of 0, so it sends return. When the central node receives it, its wait will be zero, and the collector will be done. [1,0,0] (3/2) [1,0,0] (4/3) wait=3 [1,0,0] (1/2) [1,0,0] (5/4) wait=0 Return

slide-39
SLIDE 39

Collecting With SWPR

A quiet state is achieved. [1,0,0] (3/2) [1,0,0] (4/3) wait=0 [1,0,0] (1/2) [1,0,0] (5/4) wait=0

slide-40
SLIDE 40

The Phantomization Process

  • A possible set of parent edges for

a Phantomizing graph is pictured at left.

  • The Initiator node (Node I) does

not have a parent edge

  • There is only one outgoing parent

edge per node

  • Connects all nodes in the

Phantomizing graph with edges back to the initiator

  • Parent edge cannot form a cycle

I

slide-41
SLIDE 41

Another Example...

slide-42
SLIDE 42

Collecting With SWPR

Reference counts are written like this: [2,1,0], it means strong count=2, weak count=1, phantom count=0. Weights are written like this (2/3), it means weight=2, max weight=3. [1,1,0] (3/5) [1,1,0] (1/3) [1,0,0] (2/1) [1,0,0] (5/4) [1,1,0] (3/5) [1,0,0] (4/3) [1,0,0] (2/1) [1,0,0] (5/4) Phantomize

slide-43
SLIDE 43

Collecting With SWPR

[1,1,0] (3/5) [1,0,0] (4/3) wait=1 [1,0,0] (2/1) [1,0,0] (5/4) Phantomize [1,1,0] (3/5) [1,0,0] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Phantomize

slide-44
SLIDE 44

Collecting With SWPR

[1,1,0] (3/5) [1,0,0] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Phantomize [1,0,1] (6/5) wait=1 [1,0,0] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Phantomize

slide-45
SLIDE 45

Collecting With SWPR

[1,0,1] (6/5) wait=1 [1,0,0] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Phantomize [1,0,1] (6/5) wait=1 [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return

slide-46
SLIDE 46

Collecting With SWPR

[1,0,1] (6/5) wait=1 [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return [1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return

slide-47
SLIDE 47

Collecting With SWPR

[1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) [1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return Return

slide-48
SLIDE 48

Collecting With SWPR

[1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) [1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) Return Recover

slide-49
SLIDE 49

Collecting With SWPR

[1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Recover [1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) Recover

slide-50
SLIDE 50

Collecting With SWPR

[1,0,1] (6/5) wait=1 [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Recover [1,0,1] (6/5) [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Recover

slide-51
SLIDE 51

Collecting With SWPR

[1,0,1] (6/5) wait=1 [1,0,0] (7/6) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return [1,0,1] (6/5) wait=1 [0,0,1] (4/3) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Build

slide-52
SLIDE 52

Collecting With SWPR

[1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) [1,0,1] (6/5) wait=1 [1,0,0] (7/6) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return Return

slide-53
SLIDE 53

Collecting With SWPR

[1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return [1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) wait=1 [1,0,0] (5/4) Return

slide-54
SLIDE 54

Collecting With SWPR

[1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) Build [1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) Return

slide-55
SLIDE 55

Collecting With SWPR

[1,0,1] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) wait=1 [1,0,0] (5/4) Build [1,0,1] (6/5) [1,0,0] (7/6) wait=1 [0,0,1] (2/1) [1,0,0] (5/4) Build

slide-56
SLIDE 56

Collecting With SWPR

[1,1,0] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) wait=1 [1,0,0] (5/4) Return [1,0,1] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) wait=1 [1,0,0] (5/4) Build

slide-57
SLIDE 57

Collecting With SWPR

[1,1,0] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) [1,0,0] (5/4) Return [1,1,0] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) wait=1 [1,0,0] (5/4) Return

slide-58
SLIDE 58

Collecting With SWPR

[1,1,0] (6/5) [1,0,0] (7/6) [1,0,0] (8/7) [1,0,0] (5/4) [1,1,0] (6/5) [1,0,0] (7/6) wait=1 [1,0,0] (8/7) [1,0,0] (5/4) Return

slide-59
SLIDE 59

Collecting a Two Node Cycle...

slide-60
SLIDE 60

Another Example with SWPR

[1,1,0] (1/2) [1,0,0] (2/1) [0,1,0] (1/2) [1,0,0] (2/1) Node A Node B Node A Node B Root Remove root from the cycle.

slide-61
SLIDE 61

Another Example with SWPR

[0,1,0] (1/2) [1,0,0] (2/1) [1,0,0] (3/2) wait=1 [1,0,0] (2/1) Phantomize Node A Node B Node A Node B Node A phantomizes.

slide-62
SLIDE 62

Another Example with SWPR

[1,0,0] (3/2) wait=1 [1,0,0] (2/1) Phantomize [1,0,0] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Node A Node B Phantomize Node B propagates the phantomization.

slide-63
SLIDE 63

Another Example with SWPR

[1,0,0] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Phantomize [0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Return Node A is already phantomized, so it sends Return back.

slide-64
SLIDE 64

Another Example with SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Return [0,0,1] (3/2) wait=1 [0,0,1] (2/1) Node A Node B Return Node B’s wait count is now zero, so it sends Return to its parent, A, and clears its parent edge.

slide-65
SLIDE 65

A Simple Example With SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) Return [0,0,1] (3/2) wait=0 [0,0,1] (2/1) Node A Node B Node A Node B Node A’s wait counter drops to zero. Phantomization is complete.

slide-66
SLIDE 66

A Simple Example With SWPR

[0,0,1] (3/2) wait=0 [0,0,1] (2/1) Node A Node B [0,0,1] (3/2) wait=1 [0,0,1] (2/1) Node A Node B Recover Node A has no strong count, so it might be garbage. It attemps to Recover, i.e. to look for phantomized nodes which have strong incoming edges from which it can rebuild the subgraph.

slide-67
SLIDE 67

A Simple Example With SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) Node A Node B Recover [0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Recover Node B receives recover. It has no strong edges, so it propagates the Recover.

slide-68
SLIDE 68

A Simple Example With SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Recover [0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Return Node A is already recovering, so it sends Return.

slide-69
SLIDE 69

A Simple Example With SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=1 Node A Node B Return [0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=0 Node A Node B Return Node B’s wait count is zero, so it returns and clears its parent edge.

slide-70
SLIDE 70

A Simple Example With SWPR

[0,0,1] (3/2) wait=1 [0,0,1] (2/1) wait=0 Node A Node B Return [0,0,1] (3/2) wait=0 [0,0,1] (2/1) wait=0 Node A Node B At the end of recovery, Node A still has no strong nodes...

slide-71
SLIDE 71

A Simple Example With SWPR

[0,0,1] (3/2) wait=0 [0,0,1] (2/1) wait=0 Node A Node B [0,0,1] (3/2) wait=0 [0,0,1] (2/1) wait=0 Node A Node B Delete Node A knows it’s garbage. It sends Delete along all its

  • utgoing edges, then deletes those same edges. It does not

set its wait count.

slide-72
SLIDE 72

A Simple Example With SWPR

[0,0,1] (3/2) wait=0 [0,0,1] (2/1) wait=0 Node A Node B Delete [0,0,1] (3/2) wait=0 [0,0,0] (2/1) wait=0 Node A Node B Delete After Node B receives Delete, it propagates the message and deletes itself. Node A cannot be reclaimed until it receives Delete from B. Once it does, it deletes itself.

slide-73
SLIDE 73

The Multicollector

○ ○ ○

slide-74
SLIDE 74

The Claim Message

{0,1,0} [0,0,1] (2/1) {0,1,0} [1,0,1] (3/2) [1,0,0] (2/1)

  • The tuples {0,1,0} and

{0,2,0} are collection id’s. For now, the first and last tuple element are zero.

  • The middle value is the

main id, and must be

  • unique. It can be the

node id.

{0,1,0} [0,0,1] (4/3) Phantomize

slide-75
SLIDE 75

The Claim Message

{0,1,0} [0,0,1] (2/1) {0,1,0} [1,0,1] (3/2) {0,2,0} [1,0,0] (2/1)

The Phantomize message is traveling toward an already phantomized node. Normally this would immediately return. If the sending tuple were smaller or equal to the receiving, it still would return.

{0,1,0} [0,0,1] (4/3) Phantomize

slide-76
SLIDE 76

The Claim Message

{0,1,0} [0,0,1] (2/1) {0,2,0} [0,0,2] (3/2) wait=3 {0,2,0} [1,0,0] (2/1) wait=1

However, in this case, the Phantomize comes from a higher collection id, namely {0,2,0}. So instead of returning immediately, it marks the receiving node with its id and sends Claim along its outward edges..

{0,1,0} [0,0,1] (4/3) Claim

slide-77
SLIDE 77

The Claim Message

{0,1,0} [0,0,1] (2/1) {0,2,0} [0,0,2] (3/2) wait=3 {0,2,0} [1,0,0] (2/1)

Claim propagates in the same way Phantomize does.

{0,2,0} [0,0,1] (4/3) wait=1 Claim

slide-78
SLIDE 78

The Recovery Count

{0,1,0} [0,0,1,1] (2/1) {0,2,0} [1,0,2,1] (2/1) {0,2,0} [0,0,1,1] (2/1)

  • When a node receives a

recovery from a node with the same collection id, the recovery count is incremented.

  • Unless the phantom and

recovery count are equal, nodes cannot send return messages or decide to start deleting.

slide-79
SLIDE 79

The Return and Start Over Mechanism

{0,1,0} [0,0,1] (2/1) {0,1,0} [1,0,1] (3/2) wait=3 {0,2,0} [1,0,0] (2/1) {0,1,0} [0,0,1] (4/3) wait=1 Phantomize Consider this scenario...

slide-80
SLIDE 80

The Return and Start Over Mechanism

{0,1,0} [0,0,1] (2/1) {0,2,0} [0,0,2] (3/2) wait=3 {0,2,0} [1,0,0] (2/1) {0,1,0} [0,0,1] (4/3) wait=1 Return And Start Over (RSO)

The new collection has to take over, but we can only have a single parent edge, so we send Return And Start Over to the current parent and set a new parent.

slide-81
SLIDE 81

The Return and Start Over Mechanism

{0,1,1} [0,0,1] (2/1) {0,2,0} [0,0,2] (3/2) wait=3 {0,2,0} [1,0,0] (2/1) {0,1,0} [0,0,1] (4/3) wait=1

Pink node starts over with a slightly higher collection id (incremented minor id)

Claim or Recover

slide-82
SLIDE 82

How These Mechanisms Work Together

Collection {0,1,0} Collection {0,2,0} Collection {0,2,0} takes over the collection of the two nodes at right.

slide-83
SLIDE 83

How These Mechanisms Work Together, Take 2

Collection {0,2,0} Collection {0,1,0} Collection {0,2,0} waits for {0,1,0} to finish, then collects its two nodes.

slide-84
SLIDE 84

How These Mechanisms Work Together, Take 3

Collection {0,1,0} Collection {0,1,0} starts... Init {0,1,0} {0,1,0} Recover

slide-85
SLIDE 85

How These Mechanisms Work Together, Take 3

Collection {0,1,0} The red edge is removed Init {0,1,0} {0,1,0} Recover

slide-86
SLIDE 86

How These Mechanisms Work Together, Take 3

Collection {0,1,0} Init Return {0,2,0} {0,1,0} Danger: If we didn’t increment the minor id, the blue “Init” could finish and clean up, but it should be kept alive by red “Init.” Init Recover

slide-87
SLIDE 87

How These Mechanisms Work Together, Take 3

Collection {0,1,1} Collection {0,1,1} stalls and waits to be taken over by {0,2,0} Init {0,2,0} {0,1,0} Init Recover

slide-88
SLIDE 88

Working with a Mutator