Test Fora Race Condition

BillTrost asks, how would you test for a RaceCondition?

Start the system. Start a separate task. The separate task generates interrupts more and more rapidly, in a loop.

Start the system. Start a separate task. The separate task reads a script of interrupts to generate and the time between them. Generates them.

This is almost always possible, because the CPU can usually generate interrupts faster than any external device. (6502 processor is an exception ;-> )

Most interrupt-related problems IME are due to not getting off the interrupt fast enough. The usual thing to do is to make a trivial interrupt routine that semaphores a queue and enqueues the "real" command. The next lower priority from interrupt has a looping task dequeueing and doing work (also semaphored on the queue, of course). In a system built this way, interrupt-related problems are quite rare. -- RonJeffries

This is how the UnixOperatingSystem and its DeviceDrivers are structured. This sounds like a pattern to me.


EditText of this page (last edited July 12, 2013) or FindPage with title or text search