Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

1 Design: A Thread-safe Hashmap

Design: A Thread-safe Hashmap

Similar Posts:

Typical methods of hashmapget, update, delete, exists, size
Avoid frequent write lockingInstead of lock the whole array, lock at smaller granularity of segments
To speed up lookup of conflictsChange linked list to balanced binary search tree
ReferenceLink: Internal Working of HashMap in Java
ReferenceLink: How ConcurrentHashMap Works Internally in Java

Q: How support basic hashmap?

  1. Eventually store data of hashmap in an array
  • Resize

Q: Use case of concurrent hashmap?


Q: How to avoid hashing conflict?


Q: Would there be write conflicts or dirty reads?

  • Lock when updating the map
  • No locking for reading values

Q: How hashmap extend the capacity? How to resize?


Q: How ConcurrentHashMap is implemented in popular programming languages?

You can’t perform that action at this time.