Re:Practical Libc-free threading on Linux
by jart on Friday March 24, 2023 @01:35AM
(#35285433)
Explain how to do locks without using the lock instruction!
[ Parent
| on HN ]
Re:Practical Libc-free threading on Linux
by jnordwick on Friday March 24, 2023 @06:19AM
(#35287162)
does xchg count
That's an implicit lock.
futex will do lock instructions for you in kernel space. It's non optimal to just jump to kernel space every time, but it should still at least be correct.
A system call has even more overhead than the lock prefix!
True, but arguably this article constrains itself to the kernel-user boundary, where atomic instructions could be considered out of scope considering how the Linux syscall ABI is constructed.