From: brad <maitre@ccs.neu.edu>
The immediate task at hand is that i want to get readings from an instrument (a light sensor) at a uniform interval, say every 1000 micro seconds. I have been able to achieve this task by setting up the loop i described above. However the loop above takes 99% of the CPU. I'd like to be able to achieve this without pegging the CPU at 99%. Does this make sense? if not i can try explaining it again, perhaps with some code.
The kernel i'm running is 2.6.12. (well uname -r reports '2.6.12-9-686-smp.' its ubuntu's stock smp kernel.)
You are doing something that Linux was not designed to do. But don't despair, you are not the first one. There is RT-Linux, (Real-Time Linux), which consists of a real-time scheduler (meaning that it is designed to schedule tasks with non-negotiable time constraints), which treats the entire Linux kernel as a background task. Assuming your raw processor speed is sufficient (without which you lose no matter what you do), the RT-Linux scheduler will run your special task at guaranteed intervals, while any network, disk I/O, web browsing, etc. that you need to do can use the Linux system in the cracks between. Also the embedded Linux project and uCLinux (microComputer) Linux might be interesting. Give any of these terms to Google and get back more than you can read, but here is a link to get started: http://www.linuxdevices.com/articles/AT3694406595.html -- Keith