As is mentioned in the title, I wonder how to monitor the interleaving for concurrent program. For C#, I have tried to use profiling API to instrumentate a concurrent program, to get its run trace. But after thinking for a while, it cannot work, because the injecting statement is also in concurrent scheduling, which cannot reflect the real run trace.For example, proram foo is a concurrent function:
<br />
function foo()<br />
{<br />
statement a;<br />
statement b;<br />
}<br />
after instrumentation, the function should be:
<br />
function foo_instr()<br />
{<br />
inserting statement;
statement a;<br />
insterting statement;<br />
statement b;<br />
}
Supposing there is 2 threads running, I want to get a trace like: thread_1 a -> thread_2 a -> thread_2 b -> thread_1 b. But using the instrumentation method, I find I cannot get the correct run trace, as the inserting statement is also in concurrent program as well. So how can I handle it?
Additional, is there way to analysis the shared memory access between thread? So I can just log the shared memory access trace.
Appreciating for your answers.