Closed necromancersecret closed 8 years ago
Please do share some inputs
Hi Neo.
Thanks Mr. Manugoyal
One more thing. what about the case, If in a multiprocessor machine 2 threads are updating exactly the same key with different objects at exactly the same time , then in that case what will be the results ?
Neo
Hi Neo,
He already answered this exact question:
All of the updates will run, but in an unspecified order. So probably the update that runs last will have the winning value.
So, in that case, the updates will be linearized. Both will run, but the order is not specified. If your update is something commutative like addition, then the map value will have the sum of the two updates. But, if you're e.g. just setting the key to a certain (possibly different) value from two different threads, then the map will have one or the other of the values. The state will be consistent (I.e. No wrecked memory from concurrent access), but the updates will run in an unspecified order.
Hello I am going to use libcuckoo concurrent hash map in my application. Its multi threaded application with thread pool. Few clarificaaitons
Neo