1. A computer-implemented method for managing shared memory, comprising: building an interference graph associated with a number of shared memory locations; statically assigning a first number of locks to a portion of the number of shared memory locations during compile-time of a program based on the interference graph; dynamically assigning a second number of locks to a remaining portion of the number of shared memory locations during runtime of the program.