How to do distributed locking

How to do distributed locking