Consistent global state : algorithms and an application in distributed garbage collection