Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-05-2009, 09:39 AM   #1
LQ Newbie
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
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,
Old 01-05-2009, 11:08 AM   #2
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 178Reputation: 178
Your language is not quite understandable at a crucial point in the sentence. Could you ask this in different words, please?
Old 01-05-2009, 11:33 AM   #3
Registered: Jan 2005
Location: germany
Distribution: suse, opensuse, debian, others for testing
Posts: 307

Rep: Reputation: 32
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.
Old 01-05-2009, 12:02 PM   #4
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
artsd problem hogging cpu and memory jolphil Mandriva 2 04-15-2007 07:53 AM
Printing and lpd demon hogging cpu windsurfer Linux - Software 2 02-19-2007 04:48 AM
Zombie/Sleeping processes hogging CPU nomind Linux - General 2 04-21-2006 12:22 PM
What's hogging all my memory? cdavidson Linux - Newbie 5 03-29-2005 04:15 PM
bittorrent hogging the bandwidth PawnsharK Linux - Software 0 05-23-2004 11:17 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration