Java / Concurrent collections
Difference between Hashtable and ConcurrentHashMap in Java.
ConcurrentHashMap uses multiple buckets to store data. This avoids read locks and greatly improves performance over a HashTable.
Hashtable uses single lock for whole data. ConcurrentHashMap uses multiple locks on Segment level (16 by default) instead of whole Map.
ConcurrentHashMap Locking is applied only for updates. In case of of retrievals, it allows full concurrency, Retrievals reflect the results of the most recently completed update operations. So Reads can happen very fast while write is done with a lock.
More Related questions...