1
I have some data acquisition application running under Linux 2.6.37 on DM8148 with TI Linux. I have two threads:
thread named IDE, scheduled as SCHED_RR, prio 114 (75), which collects data from HW FIFO arriving at 200KiB/s into 30MiB ring buffer each 2ms:
while(1) { sleep(ms); while(DataInFIFO) { CollectToRingBuffer(); SignalToWriter(); } }
thread WriterIDE, scheduled as SCHED_RR, prio 113 (74), writing this ring buffer in to the USB disk-on-key.
while(1) { WaitForSignal(); writeToFileOnDOK(); }
I know from measures of "write()" function that sometimes this USB writing may "hang" for some 1.5 and even 2 seconds, trying to write to the DOK. But I was sure that as I gave the collector task 30MiB, which is enough for 150s, everything will be OK.
No! It is not!
I put the time measuring code. And what I see is, that when writer hangs for a long time (f.e.1342ms), then entering the collector thread time also is very large (306ms). This causes HW FIFO overflow and data inconsistency.
I checked the spread of threads priority in the system (ps command) - nothing is real-time, except me. All system tasks are scheduled as OTHER (TS in ps output), even kernel USB threads. Only IRQ tasks are FF, but even them are of lower priority.
I don't know where to go from here...:-(
Please, help!