Description
There's one remaining usage of cpu_relax
in spinning the first domain while waiting for the second domain to start-up:
https://github.com/jmid/multicoretests/blob/8a9a2327e06036f06ca5ef4b1321129ccff557d6/lib/lin.ml#L122-L124
Now that we have statistics in place, it would be natural to give this Domain
setup a run-down to see what aspects actually influence the bug-finding ability similar to what I did for Thread
recently: https://github.com/jmid/multicoretests/blob/8a9a2327e06036f06ca5ef4b1321129ccff557d6/src/statistics/README.md?plain=1#L129-L143
For Thread
a wait loop had an significant effect. For Domain
it would be nice to confirm - and also investigate whether there could be better ways to accomplish this. In the tests for the work-stealing deque that has now been pulled out of domainslib
the spinning did not work at all to trigger issues on MacOSX, so I ended up going with a binary semaphore: https://github.com/jmid/multicoretests/blob/8a9a2327e06036f06ca5ef4b1321129ccff557d6/src/domainslib/ws_deque_test.ml#L131-L133
The simpler, the better. A combination of a Mutex
and a Condition
variable may also be sufficient.
Originally posted by @jmid in #43 (comment)