Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, that specific benchmark is actually likely to prefer undesirable behaviors, for example pathological unfairness: clearly the optimal scheduling of those threads runs first all the increments from the first thread, then all of the second thread, etc... because this will minimize inter-processor traffic.

A mutex that sleeps for a fixed amount (for example 100us) on lock failure acquisition will probably get very close to that behavior (since it almost always bunches), and "win" the benchmark. Still, that would be a terrible mutex for any practical application where there is any contention.

This is not to say that this mutex is not good (or that pthread mutexes are not bad), just that the microbenchmark in question does not measure anything that predicts performance in a real application.



Yeah! For all we know this performs great on real programs.

And for all we know it’s absolute trash on real programs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: