I am writing a kernel driver that reads a high data
rate dma-like channel. I am concerned that my reader
thread will consume all of the CPU's cycles sort of
like writing a while(1) loop and locking up the PC.

I was looking into writing some sort of load manager
within the reader thread in kernel code (or in a
seperate thread).

I was thinking of periodically reading the reader
thread's CPU utilization percentage and inserting a
sleep for some amount of time if it exceeds some
threshhold. This will allow other processes and
threads to run and stop the reader thread from
monopolizing the CPU

What is the easiest way in kernel code to get the
thread's CPU utilization so I can stop my thread from
taking over the CPU? Will I have to do so in a
seperate thread or can i do it from within the reader

Any thoughts on this subject would be extermely
valuable. Thank you in advance!