How Linux locks?

Solve the re-occurring could not get lock issue.

Image: Linux Lock. Source: https://www.techsupportpk.com/2017/10/lock-linux-user-accounts.html