checkpoint algorithm