Search code examples
image-processingprocesslinux-kernelreal-timeethernet

Need to improve the Linux performance for embedded system


I have a ARM OMAP based embedded system with 1 GHZ processor running Linux 2.6.33 cross compiled as CONFIG_PREEMPT. One of the Processes (process 1) is critical and need to run every 4 or 8 milli sec which is configurable. There is another process's (process 2) thread which transfers image to FTP or any other configured application. To trigger the time critical process 1 i use a high resolution timer as a seperate thread (FIFO, say 60) with highest Real time priority in the system. Process 2 is having lower RT priority (RR 20) than process 1 (RR 50).

If there is no image transfer enabled or configured i dont see any timeouts for the critical process (process 1) mentioned above. But if i enable any image transfer then the process 1 will timeout or the image transfer fails due to some error and one of these process dies and then other process runs fine.

I see that if the image resolution is higher then the timing out of process 1 is faster. With higher resolution of image (say SXGA) the NET_RX ethernet interrupt holds the CPU for long time and by the time it gives up CPU, process 1 timesout. It looks like NET_RX interrupt is having highest priority than timer interrupt used for process 1 and it doesn't give the CPU.

I want to make sure both process running and process 1 should not miss the deadline. How to debug the system that where it is exactly waiting so that i can remove those waits or atleast avoid those if possible.

How can i achieve this ? Please help.


Solution

  • Linux is not a real-time operating system. It offers no guarantees other than "best efforts" scheduling.

    If you have a task which has to run at a particular rate all the time, you need to run that task under a proper RTOS which can make those sorts of guarantees.

    Otherwise you have to relax your constraints to "runs every 4ms, mostly".