Cost-Effective Contention Avoidance in a CMP With Shared Memory Controllers