lock contention - what can we do about it?

Ciprian Ciubotariu cheepeero at gmx.net
Sun Mar 6 23:51:22 UTC 2011


The spinlock used for DUChainLock does active waiting, using usleep to yield the CPU from the waiting thread. The amount of time each thread spends on idle should be the time spent in that usleep, plus time spent waiting on other OS sempahores (QMutexes etc.).

It just came to me that one way of testing the DUChainLock contention is to remove the usleep in class DUChainLock and measure the amount the CPU utilization grows. The actual work won't go faster, since the thread is still waiting, but this time fully utilizing CPU cycles. The rest of the CPU utilization up to 100% (or 200% for 2 CPUs) account for the rest of the locks.




More information about the KDevelop-devel mailing list