Patent ID: 8645963

Claim:
A method for grouping two or more threads based on lock contention information, wherein the method comprises: determining lock contention information at run-time with respect to two or more running threads; using the lock contention information with respect to the two or more threads to determine lock affinity between the two or more threads by collating the lock contention information in a data structure that maintains a number of contentions that occur between every pair of running threads that contended on a lock at least once; using the lock affinity between the two or more threads to group the two or more threads into one or more thread clusters by scanning the data structure to form a thread cluster of the two or more threads only after a pre-determined minimum number of contentions between the two or more threads, wherein the pre-determined minimum number of contentions is two or more; decaying the contention count between each pair of threads in the data structure to determine current thread cluster information; and using the one or more thread clusters to perform scheduling of the grouped two or more threads on a same processor.