Linux App CPU Usage

I’ve had reports from a user of mine running Linux that my app is taking 50 to 60% CPU time while just sitting idle. Tonight I checked out my instance of my app running in Linux and sure enough running TOP in terminal in Ubuntu shows a cpu time of between 55 and 60% when the app is just sitting there.

I use Aaron Ballman’s (or is it Alex Restrepo’s - I forget) thread pool manager class in my app so there’s a constant loop in the thread that sleeps each loop iteration if there’s nothing being added to the thread pool. I know if the sleep value is too low that this can increase CPU time. So I experimented and raised it to 10 seconds. No difference. Now I’ve tried suspending the thread until a new item is added to the pool. No difference. I’m still seeing 56% CPU time. The only items running are the main thread and the thread pool thread which is suspended.

I do have a number of TCP sockets open but that shouldn’t affect CPU time.

What’s causing this? Is it just the way the framework handles things in Linux and it really doesn’t matter?