Lock Algorithms