Locks is an important cornerstone in Parallel programming. Care has to be taken when to use locks, and when not to. Too many locks will impair your applications ability to scale on many cores. However, too few locks can quite likely cause your application to be incorrect, and in general, your invariants must be protected.

More details on locks available on locks below.