Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

concurrent linked list insertion #60

Closed
fairy-of-9 opened this issue Jun 5, 2019 · 5 comments
Closed

concurrent linked list insertion #60

fairy-of-9 opened this issue Jun 5, 2019 · 5 comments

Comments

@fairy-of-9
Copy link

Hi...

제목 없음

I don't know what the letters in the red square are.
I'm sorry... I didn't concentrate in a lecture...

Thanks

@jeehoonkang
Copy link
Member

Succeeded

@fairy-of-9
Copy link
Author

Thank you...!!

@giangnguyen2412
Copy link

@jeehoonkang in this case, if ThreadA succeeded, the Y.next will be changed from Z to new of ThreadA, then threadB executes, but we still keep the condition Y.next.compare_and_set(Z, new). I am supposing that threadB will always fail because Y.next is now new-of-threadA, not Z anymore.

Is this correct?

@jeehoonkang
Copy link
Member

@luulinh90s I forget the context of this.. I assume two threads concurrently try to insert a node, right? Then yes, if thread A succeeded in CAS, then thread B will not be able to succeed in CAS too.

@giangnguyen2412
Copy link

Then in the case of insertion, we will not try again at all, right?
Furthermore, in case of removal and insertion are performed at the same time, if Insertion-thread (thread trying to insert) detects Z is marked to remove, we also don't need to try again because at this time, Insertion will always fail, am I right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants