-   Programming (
-   -   CPU hogging. (

kirankumarburgu 01-05-2009 09:39 AM

CPU hogging.
Hi all,

i just put while(1) in main and exuected that on one of the linux, top shows 99.9 cpu utilization is hogged by this process, in this case if i executed any other process on this machine,it shouldt get any processor time but its not happening......can someone tell me reason for this.

Thanks in advance,

wje_lq 01-05-2009 11:08 AM

Your language is not quite understandable at a crucial point in the sentence. Could you ask this in different words, please?

rtspitz 01-05-2009 11:33 AM

you need to start your code 'niced'.


nice -n 19 name_of_your_executable
this will make sure this job does not hog cpu time, when it is needed elsewhere.

theNbomr 01-05-2009 12:02 PM

Your program is requesting (by not sleeping or waiting) CPU time, which it is getting because no other process is reequesting CPU cycles. The scheduler in the kernel will try to share the CPU equitably according to its algorithms to all processes that want it. So as soon as processes compete for CPU time, they will be given their fair share, which seeems to be what you are seeing.
--- rod.

All times are GMT -5. The time now is 09:59 PM.