filter lock & bakery lock algorithm