Run kmeans with locks