title: How ConcurrenthashMap manages if Concurrency level is HIGHER than the number of Buckets?
body: <p>The <code>ConcurrentHashMap</code> uses <em>segment level locking</em> mechanism for supporting concurrent modifications. It has three basic parameters</p>
  
  <ul>
  <li>Number of Buckets. (Default initial size = 16)</li>
  <li>Concurrency Level. (Default size = 16)</li>
  <li>Load Factor.(Default size = 0.75)</li>
  </ul>
  
  <p>In default case we have <em>Single Lock per Bucket</em>. If the number of buckets are made as 32 then we will have <em>Single Lock per Two Buckets</em>.</p>
  
  <p>How is it managed if number of buckets are <strong>Less</strong> than the Concurrency Level, i.e. if </p>
  
  <pre><code>Map cMap = new ConcurrentHashMap(16,1,32); 
  </code></pre>
  
  <p>Usually a bucket uses a Collection (Linked List) for the items with Hash-codes colliding in same bucket. Do we have in above case Two Locks per Bucket, if yes then how it is managed, (does half of the collection in a bucket uses one lock and other half uses second lock ?)</p>
  
  <p>I have searched and was able to see the answers if the <code>ConcurrentHashMap</code> is resized to have more buckets than the number of Locks but I was not able to get an answer what if it was the reverse case, i.e :</p>
  
  <p>How ConcurrenthashMap manages if Concurrency level is HIGHER than the number of Buckets ? </p>