If I understand this correctly, it basically has the second thread wait until the first one experiences a hardware interrupt, which implicitly synchronizes memory. This avoids the first thread from needing any synchronization primitives that would slow it down.
j_seigh 4 hours ago [-]
Sort of. Basically you have a situation where one thread needs to see another thread's memory accesses in sequential consistent order. If you can determine the other thread has synchronized its memory accesses at some point, then all its memory accesses before that are in observably sequentially consistent.
The thing is you don't know exactly when that synchronization took place so your code logic has to take that into account. In the case of hazard pointers, false positives are ok and false negatives, i.e. thread is using reference that was not detected, cannot occur.
There's 2 or 3 other tricks you can make hazard pointers wait-free. Getting rid of the conditional branching in the instruction pipeline gives you a considerable speed up.
Jweb_Guru 14 hours ago [-]
Oh boy this is a cool blog post. Encourage everyone to read it.
senderista 14 hours ago [-]
There are many more cool posts on that blog.
preetham_rangu 12 hours ago [-]
same trick QSBR uses for lock-free reclamation, just framed at the OS scheduler level instead of userspace
7e22v837278gb1p 16 hours ago [-]
"GC"?
mwkaufma 15 hours ago [-]
Garbage collection. It's in the leading paragraph of the article so I can see why it's easy to miss.
winterissnowing 8 hours ago [-]
[flagged]
Rendered at 18:00:20 GMT+0000 (Coordinated Universal Time) with Vercel.
The thing is you don't know exactly when that synchronization took place so your code logic has to take that into account. In the case of hazard pointers, false positives are ok and false negatives, i.e. thread is using reference that was not detected, cannot occur.
There's 2 or 3 other tricks you can make hazard pointers wait-free. Getting rid of the conditional branching in the instruction pipeline gives you a considerable speed up.