garbage collecting the world. --bernard lang, christian and jose

27
Garbage Collecting the World. --Bernard Lang, Christian and Jose Presented by Shikha Khanna coen 317 Date – May25’ 2005

Upload: noma

Post on 25-Feb-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Garbage Collecting the World. --Bernard Lang, Christian and Jose. Presented by Shikha Khanna coen 317 Date – May25’ 2005. Index. Introduction Terminology Basic Algorithm Handling Failures Group Contention Modified marking scheme Conclusion. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Garbage Collecting the World.--Bernard Lang, Christian and Jose

Presented by Shikha Khannacoen 317Date – May25’ 2005

Page 2: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Index

Introduction Terminology Basic Algorithm Handling Failures Group Contention Modified marking scheme Conclusion

Page 3: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Introduction

Computations performed by collection of processes are more and more common today.Ex - distributed symbolic computations

- distributed databasesThis involves existence of remote references i.e objects at distant node referencing memory in each others address space which leads to unused memory.

The paper presents a distributed garbage collection algorithm to remove such unused memory.

Page 4: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Terminology

Node – Processor or a process on a processor able to manage its own memory space.

Mutator – process that allocates chunks of memory (cells). Cells contain references to cells in same or other nodes.

Root – each node contains roots which are references to memory (cells) it considers useful. Ex – all cell references in the cpu registers or in an execution stack are roots.

Reachable – cells referenced to by root directly or indirectly through other cells are live.

Unreachable – waste or unused memory

Page 5: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Terminology (contd)

Local reference – reference to cell (memory) on the same node or processor.

Remote reference – reference to cell on another node.

Entry & exit items – a remote reference to cell is represented by a reference to an exit item on the same node, which references an entry item on another node.

Page 6: Garbage Collecting the World. --Bernard Lang, Christian and Jose

The basic Algorithm

Group Negotiation Initial marking Local propagation Global propagation Stabilization Dead cycles removal Group disbanding

Page 7: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Group Negotiation

When a node decides to participate to new group GC, it first determines what group can be set up for that purpose.

Why? It could have been idle or its entry items may not have been accessed for a long time or it was not currently involved in any group GC.

How? Groups can be created based on geographic distances.Once created, a unique identifier is associated with each group GC and is made known to each of the nodes in the group.

Page 8: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Initial Marking

Within each group, entry items have a mark( soft or hard). Hard – entry item referenced outside the group or roots. Soft – referenced from within group. Christopher’s algorithm used for marking – look at

reference counter for entry item. Say it is K. If the number of exit items referencing that entry item within the group is K , then entry is marked soft. Else there is a reference from outside the group so mark it as Hard.

Page 9: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Local Propagation

Local GC are responsible for propagation of marks from entry items to exit items they reference locally, directly or indirectly.

2 phase marking– Trace from entry items marked hard as well as

from root set. Any exit item reached from this tracing is marked hard.

– Start from soft entry items and mark all exit items reached by this tracing as soft

Page 10: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Hard marks of exit items are propagated to their corresponding entry items within the group.

Global Propagation

Page 11: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Stabilization

Group is said to be stable if– Nodes are stable, i.e they have no new data that

could justify hardening more entry items locally or elsewhere in the group.

– No new messages in transit that request the hardening of some entry item.

– How? Group stability can be detected by any node termination detection algorithm.

Page 12: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Dead cycles removal

After stabilization,– Remove all entry items marked as soft.

Page 13: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Group disbanding

When a group GC is finished, its associated group may be disbanded. All data structures relative to this group can then be reclaimed.

Page 14: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Failure Handling

A node can detect failure of other nodes based on acks and time-outs.

A node that detect failure can– Decide that it is temporary and wait for failed

node to wake up.– Re-organize the group i.e create a new group

excluding the failed node.

Page 15: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Failure Handling(2)

A transmission link may fail and divide a group into subgroups. These subgroups start independent GC. (result – all dead memory will be cleaned)

Page 16: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Failure Handling(3)

When a node has a non-recoverable failure– What happens to entry referenced by failed node?Group G – calculate the number of entries and

reference count of each entry. Suppose entry A has 4 references.

Group G’ (G – failed node) do the same. Entry A now has 3 references. So A was being referenced by the failed node.

Send a decrement message to that entry

Page 17: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Simultaneous Group Collections

A node may belong to more than one group. Aim – The results obtained by a local garbage

collector on a node can be used in other groups to which the node belongs. i.e markings can be used across the groups.

Adv – In a large n/w with variations in network connectivity and communication speed, GC is much more faster and efficient if groups are broken down into sub groups.

Page 18: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Group Contention(1)

Consider a subgroup G’ of G. If an entry item is marked hard in G then it can also be marked hard in G’. However some entry items that are soft w.r.t G will be hard w.r.t G’.

G

G’x

xx

xx

x

x

x

- GC of any one group can take place at a time.Problem – Markings cannot be used across groups

Page 19: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Group Contention (2)

Conversely if a local Garbage Collector works for the group GC of G’, its hard marking cannot be used for G. However soft markings may be used.

G

G’x

xx

xx

x

x

x

Page 20: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Group Contention (3)

The situation is worse if a node belongs to overlapping groups. The markings (hard/soft) of local garbage collector with group A or B cannot be used at all for the other.

A B

Page 21: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Contd…

This necessitates of having strictly hierarchical embedding of groups to avoid contention over the services of local garbage collector.

Page 22: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Hierarchical cooperation of group GCs

Soln to the group contention problem by modifying the marking scheme.

Groups are organized in a strictly hierarchical order by inclusion.

Each group is assigned a level index – number of groups it is strictly embedded in.– Universal group – level index 0

Page 23: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Contd..

In this scheme instead of binary hard and soft marks, we use integer marking scheme. REST OF ALGO REMAINS SAME.

Mark for a node entry is the least level for which the entry could be marked hard.

For group 3, left side is hard and right side is soft.

H s31 2

Page 24: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Marking scheme

- Entry at N1 is hard w.r.t G2 - Entry at N1 is soft w.r.t G1- Marking of entry is 2

N1

g0g1

g2

g3

X

Xx

Page 25: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Contd..

Local Propagation – Instead of prop H/S marks levels are prop from entry to exit items.

Rest of the algorithm is exactly SAME.

Page 26: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Final GC

N1

g0g1

g2

g3

X

Xx

After prop of all marks, all Entry itemsWith mark > 2, are soft w.r.t G2 henceGarbage collected.

Page 27: Garbage Collecting the World. --Bernard Lang, Christian and Jose

Conclusion

Thus we saw a distributed GC algo which is– Fault tolerant.– Does not need a centralized control.– Allows for multiple concurrent active GCs.– Eventually reclaims all inaccessible objects

including distributed cycles.