Sunday, May 13, 2012

ConcurrentHashMap and hashTable

So what is the difference between hashtable and ConcurrentHashMap , both can be used in multithreaded environment but once the size of hashtable becomes considerable larg,e performance degrade because for iteration it has to be locked for longer duration.

Since ConcurrentHashMap indroduced 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.

Just collecting notes and sharing..
Please let me know if there're wrong statements in this article or copy-paste one.

No comments:

Post a Comment