3 ms·
That's precisely the point: if threads never block or yield the CPU, you can guarantee system-wide progress. If you have an algorithm which might deadlock, 'pr
by HenryR 10y ago
That's precisely the point: if threads never block or yield the CPU, you can guarantee system-wide progress.
If you have an algorithm which might deadlock, 'progress' isn't really well defined.
- gpderetta 10y agoAgain, you can't ever guarantee that a thread never block or yield; it might have bugs, it might get a machine exception, it might have to deal with buggy hardware, someone might have attached an external debugger, etc. These might be rare events and not worth worrying about. And a spinlock might actually be the fastest implementation for your algorithm. It still doesn't make it lock free. edit: ah, and you might be running under a virtualized cpu and the host takes the cpu away from you. Edit: another one: SMM mode kicks in and takes the CPU away from the OS.