<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Clemens,<div><br></div><div>For making my implementation of shared memory data structure more space efficient, I was trying to implement a stack which stores offsets to unused locations in the shared memory file. But as stack is being shared it also needs to be edited in a lock free way. While editing stack I need to atomically CAS both top of stack and the element on it. For this I found double compare and swap. Also, in my data structure at one point I need DCAS as well to ensure correct editing. </div><div>To implement DCAS I came across some instruction “cmpxchg16”. But I think its still not as per my need. [1]</div><div><br></div><div>Do you know any alternative with which I can DCAS atomically or anything which atomically checks 2 old values before replacing value at an address?</div><div><br></div><div>[1] <a href="https://stackoverflow.com/questions/7646018/sse-instructions-which-cpus-can-do-atomic-16b-memory-operations">https://stackoverflow.com/questions/7646018/sse-instructions-which-cpus-can-do-atomic-16b-memory-operations</a></div><div><br></div><div>Regards,</div><div>Mihir</div></div></div></div></div>