4 ms·
I'm not familiar with the area, so am likely missing something, but how do they do deterministic thread-level context switching? Something like: var_1 = 0
by wzdd 3y ago
I'm not familiar with the area, so am likely missing something, but how do they do deterministic thread-level context switching? Something like:
var_1 = 0
var_2 = 0
thread_a:
while true:
something_complex()
var_1 ++
thread_b:
while true:
something_complex()
var_2 ++
Under the quoted definition of determinism, for every point in time, var_1 and var_2 should have the same values across all executions. But this would seem to amount to ensuring that exactly the same number of instructions are executed each time a thread is scheduled.
- wwilson 3y agoYou are exactly correct. Our hypervisor grants you this power (and then we use the power to explore as many possible values of var_1 and var_2 as we can, in case some of them trigger a concurrency bug, e.g.)
- wmf 3y agoensuring that exactly the same number of instructions are executed each time a thread is scheduled AFAIK this is possible by (mis)using performance counters.
- wwilson 3y agoAlex discusses this in the post. Performance counters were the first thing we tried, but alas they're non-deterministic about every one-in-a-trillion instructions.