-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set to invalid hashmap in concurrent situation #87
Comments
But this one has already taken a lock on the bucket in Delete and the rest will have to wait for the operation to complete.
To be honest, I didn't really understand how this is possible. There is also a lock on the bucket first. Can you explain in more detail, please? |
Sorry, i post the wrong code link for "Delete run into this line and Set run into this loop,", please recheck the link again. Here is an example to show how that will happend:
This situation just like above, two |
If these operations are performed at the same time, then the lock for
Yeah, this is a more interesting case. The main magic here is done by |
Wow, i missed the lock in
|
What do you mean by "soft limit"?
These checks are necessary for the case when we have already started to perform |
|
func (m *Map[K, V]) Delete(key K) node.Node[K, V]
andfunc (m *Map[K, V]) Set(n node.Node[K, V]) node.Node[K, V]
can run concurrently, whenDelete
run into this line andSet
run into this loop, there is chance thatSet
node to an invalid(shrinked) table.I think this may acceptable in this situation.
And here is another question, in hash map
set
, there is a judgmentif m.newerTableExists(t)
, does it used to lower the probabilityset
to an invalid table? Because when concurrently run multiset
, there still may create a new table even after this judgmentif m.newerTableExists(t)
Thanks!
The text was updated successfully, but these errors were encountered: