Bloomberg LP Interview Question
Software Engineer / Developerskill -6 is one solution as one user mentioned
Set conditional breakpoints by having counters at multiple places in the suspected process. Based on one counters hitting a certain count you can break and look into the possible buggy code area
You can have throttled printf mechanism based on the above counter logic
A normal process executing in user mode cannot consume 90% of CPU as the process will get switched out after it consumes its time share slot.
If the process is a Real Time process and has a bug in its code, inspite of getting preempted after its timeshare, it could get the cpu right back if it is the highest priority process. So, it may show 90% accumulated cpu usage over time, but cannot consume 90% in one continuous grab of cpu time.
The only way for the cpu to be 90% consumed by one process is some sort of kernel problem. Usually, there is some sort of an infinite loop OR a very long running process that is not preempting and giving up the CPU.
One way to debug such problems is to use kernel tracers. For example, refer to ktracer on HPUX. This tool traces kernel procedure calls, arguments and timing. So, if there is a loop and a particular stack trace is being repeatedly executed leading to a loop, we can see it in ktracer output.
A similar tool is Solaris Dtrace.
I think it is not related to Kernel..
- Anonymous January 19, 2009they may be asking at user space side only