Existing work on mutual exclusion synchronization is based on a structural definition of mutex bodies. Although correct, this
structural notion fails to identify many important locking patterns present in some programs. In this paper we present a novel
analysis technique for identifying mutual exclusion synchronization patterns in explicitly parallel programs. We use this
analysis in a new technique, called lock-picking, which detects and eliminates redundant mutex operations. We also show that this new mutex analysis technique can be used
as a validation tool in a compiler. Using this analysis, a compiler can detect irregularities like lock tripping, deadlock
patterns, incomplete mutex bodies, dangling lock and unlock operations and partially protected code.