CPU consumption

Hello experts,

I am writing an application in Solaris, which is supposed to work on PrimePower 650 and SunFire 440 machines. The application listens to the events raised by the Hardware and OS in /dev/log. The application listens to the messages logged into /dev/log and do some processing on them. Now, when there is a load condition occuring at /dev/log(i.e. number of messages per second ocurring at /dev/log is high), CPU consumption by my application shoots up to 50%, while my application is expected to consume not more than 1% CPU.
Now, I want to bring down the CPU consumption to 1%. Since the CPU consumtion can vary according to various CPU configurations, i have to ensure that the CPU consumption remains below 1% for low end CPUs.

Thanks in advance.

Currently to solve this problem, i am using the following technique:
1.Process is only reading 5 messages per second from /dev/log and process them. The process sleeps for rest of the time per second.
2. Every 100 messages, the process sleeps for 5 seconds.

This solution brings down the CPU consumption. On some CPU configurations, it is less than 1% CPU consumption. But on others still varies from 3-13%.

Please tell me if the processing delay technique used has some fundamental faults, or what is the correct technique of introducing processing delay for controlling CPU consumption.

Please also tell your suggestions for controlling CPU consumption. I would also appreciate , if you can redirect me to some links where i can find CPU consumption control techniques and fundamentals.

Thanks and regards.

This sounds like a silly requirement. Lower the priority of your process so that it is the most disfavored process on the system. And then consume all the cpu you want.

I agree with what Perderabo said. But if for some reason you really do need to keep it under 1%, check into the resource management features of Solaris 10. I'm not sure if you can limit cpu usage per process or not, but you should be able to find a way to make it work. If necessary you could even create a new user who owns and runs that process and limit the resources that user has access to.

Is this on a realtime system?