I'm trying to perform concurrency testing of a concurrent data structure. My strategy is to run the test on many threads and hope for as many context switches as possible. Every context switch is an opportunity for a race condition to manifest.
Since I'm using .NET I have no (supported) way of suspending threads. My idea is that I can use the thread priority to induce context switches. I'd randomly and frequently change the thread priority to rip threads off their CPU cores. (I believe this question is not materially related to .NET).
Is changing the thread priority immediately respected by the OS scheduler? Or is the current time quantum allowed to run to completion? If the quantum runs to completion then this strategy would not help.