3 ms·
Explain how to do locks without using the lock instruction!
by jart 4y ago
Explain how to do locks without using the lock instruction!
- jnordwick 4y agodoes xchg count
- jart 4y agoThat's an implicit lock.
- monocasa 4y agofutex 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.
- jart 4y agoA system call has even more overhead than the lock prefix!
- monocasa 4y agoTrue, 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.
- jart 4y agohttps://www.reddit.com/r/C_Programming/comments/120momf/a_lockfree_single_element_generic_queue/ https://www.reddit.com/r/C_Programming/comments/120momf/a_lo...