Difference between ConcurrentHashMap and Hashtable?
- Both can be used in multithreaded environment but once the size of Hashtable becomes considerable large performance degrade because for iteration it has to be locked for longer duration.
- Since ConcurrentHashMap introduced concept of segmentation , how large it becomes only certain part of it get locked to provide thread safety so many other readers can still access map without waiting for iteration to complete.
- In Summary ConcurrentHashMap only locked certain portion of Map while Hashtable lock full map while doing iteration.
No comments:
Post a Comment