title: Why ConcurrentHashMap cannot have a lock for each bucket?
body: <p>As we know, java's ConcurrentHashMap has a number of internal locks, and each of them guards some region of the bucket's array.</p>
  
  <p>A question is: <strong>why cannot we create a lock for each bucket</strong>?</p>
  
  <p>A similair question was already asked: <a href="https://stackoverflow.com/questions/17233924/disadvantage-of-increasing-number-of-partition-in-java-concurrent-hashmap">Disadvantage of increasing number of partition in Java ConcurrentHashMap?</a></p>
  
  <p>According to the answer, there are several reasons:</p>
  
  <ol>
  <li><p>the maximum number of threads running simultaneously is limited by the number of cores of the processor. <strong>Is this correct?</strong> <strong>Can we ALWAYS state that if we have 8-core processor we do not need more than 8 locked regions in ConcurrentHashMap?</strong></p></li>
  <li><p>There is a waste of L2 cache. <strong>Why?</strong></p></li>
  <li><p>There is a waste of memory. Looks like this is because of additional lock creation.</p></li>
  </ol>
  
  <p><strong>Is there any more reasons?</strong></p>