4 ms·
The post details why we spin for the amount of time that we do. It turns out that there is a wealth of measurements that support our 40-spins-while-yielding ru
by pizlonator 11y ago
The post details why we spin for the amount of time that we do. It turns out that there is a wealth of measurements that support our 40-spins-while-yielding rule. It worked for a strangely diverse set of workloads:
- IBM Research found it to be optimal on the portBOB benchmark on a 12-way AIX POWER box in 1999.
- I found it to be optimal for DaCapo multi-threaded benchmarks on both AMD and Intel SMPs in ~2007.
- I again found it to be optimal for WebKit these days.
The point of spinning for a short time and then parking is that parking is hella slow. That's why you can get away with spinning. Spinning is net profitable so long as the amount you spin for is much smaller than the amount of time the OS will waste while parking.