Implementing klocks and tests for locks