MCS locks and qspinlocks
MCS locks and qspinlocks
Posted Mar 12, 2014 23:04 UTC (Wed) by james (guest, #1325)In reply to: MCS locks and qspinlocks by rriggs
Parent article: MCS locks and qspinlocks
If I'm reading this correctly (and it's quite possible I'm not), the scenario would be something like:
- CPU1 obtains a lock;
- CPU2 tries to get the same lock, fails, and becomes next in line;
- CPU3 tries to get the same lock, fails, and becomes second in line;
- CPU2 is pre-empted by an interrupt;
- CPU1 releases the lock;
What I'm not sure about is how often this situation will arise in practice. Obviously, you have to have a lock with at least two CPUs waiting for the situation to arise, and an interrupt being handled on the wrong CPU at just the wrong time. It looks like this is sufficiently infrequent that the performance hit when this happens is dwarfed by the performance benefits of the technique, but it would probably be a good idea to retry the benchmark on a machine subject to a network storm.
