LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-02-2010, 10:08 AM   #1
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Rep: Reputation: 31
can one process ocupy the whole cpu while other processes are idle?


If you have a linux system with a process that has many threads.. if the rest of the processes are almost always idle, is it possible for this one process to ocupy the whole cpu by showing 99% cpu usage in vmstat ?

The linux system i have is using a linux 2.6.x kernel and i have read some about how the scheduler is working on this system, but i havent found a good explaination of how one process can consume so much cpu. when i add more processing power (more Ghz to the processor, its a virtual machine) it starts using up all that Ghz as well.

Does someone know if a process can ocupy the whole cpu like this? Its a little hard to explain what i mean, but i have a process that is consuming 90-100% cpu almost all the time, this process has about 198 threads and three of these threads are showing high cpu consumption, seems like when they need to do stuff they just "steal" the whole cpu so it goes up to 90-100% and does its thing, when analyzing this with jconsole i see it shows a red background with 99% usage of the cpu.

Could anyone comment on this?
 
Old 12-02-2010, 10:59 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 10,588

Rep: Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177Reputation: 1177
Short answer is yes.

If there is only one process trying to do something, and a cpu there running on the spot, why not use it? Doesn't mean the scheduler isn't in control.

e.g. Running glxgears on ropey drivers, I could get 99% in glxgears, and 50% in xorg-server making nearly 150%. That was a twin core. It has a different bottleneck now.
 
Old 12-02-2010, 02:14 PM   #3
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by business_kid View Post
Short answer is yes.

If there is only one process trying to do something, and a cpu there running on the spot, why not use it? Doesn't mean the scheduler isn't in control.

e.g. Running glxgears on ropey drivers, I could get 99% in glxgears, and 50% in xorg-server making nearly 150%. That was a twin core. It has a different bottleneck now.
well the problem is that, its only a java process but this java process has 7 different java applications running inside it (its the process of a java application server) and this one application has these three threads that are mainly and contantly consuming the CPU, so when im trying to use another of the applications it takes maybe about 5 seconds before i get a result from it (this other application is a content management system and the other consuming all the cpu is a search engine app) ..so i dont quite understand why it takes a whole 5 seconds when i try to get a result from the other apps, that happens also when i continue using the other apps, the search app is still taking too much cpu.. ive read that the linux 2.6.x (before 2.6.23) should have some fairness implemented in its scheduler, but i dont see it in effect here, the other threads for the other apps seem to suffer from starvation in a whole 5 second period..

this might seem like an under-dimensioned system and it is when these threads are using the cpu, but the weird thing is that when i double the cpu they just take up all that cpu too in a short amount of time and there still is this delay problem with the other applications.. also when im logged in with ssh to the server it is really slow even after i have increased the cpu with the double amount

Last edited by exceed1; 12-02-2010 at 02:22 PM.
 
Old 12-02-2010, 04:02 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by exceed1 View Post
other apps seem to suffer from starvation
Usually a symptom like that is the result of a flaw in the memory management design.

Process X may be prevented for a moment from using CPU time because it needs a page brought in from its executable file (or .so or swap area), meanwhile process Y is getting all the CPU time and touching a lot of pages (so they all are "recently used").

When the page process X needed is available, process X might immediately discover it needs another page that is on disk. The kernel needs to kick some page out of memory to make room. The kernel may kick out some page process X will need again "soon" rather than some page process Y used recently.

As long as process X spends almost all its time waiting for pages to get in, earlier pages that from its point of view were accessed very recently, from the kernel's point of view were not accessed recently and thus are good choices to kick out of memory.

So the fact that X has been running slow (because it started with so many pages on disk instead of in ram) keeps it running slow, because it never accumulates a decent size working set of pages.

This effect can be a lot stronger if process Y has multiple threads that touch heavily overlapping but not identical subsets of its address space. That keeps process Y continually trying to grab physical ram while still allowing it to run enough to avoid any significant loss of ram it already has.

Expressed (a little) more simply:
Process Y getting almost all of the CPU time causes its pages dominate the page cache.
Process Y's pages dominating the page cache prevents other processes from getting significant CPU time.
Other processes failing to get significant CPU time causes process Y to get almost all the CPU time.
And repeat ...
 
Old 12-02-2010, 04:57 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

To summarize:
1. You're observing a performance problem, and you believe it's due to a process that's consistently consuming 99% of the CPU.
Based on what you've said, I concur.

2. A poorly performing system can be any of:
a) I/O bound (too much I/O for the system to handle)
<= typically characterized by LOW CPU utilization and high wait times

b) CPU bound
<= perhaps a compute-intensive application...
or perhaps simply a buggy app that goes into an infinite loop

c) memory bound (the system doesn't have enough RAM)
<= a common issue with web servers and/or database servers;
"swapping" once you exceed physical RAM can manifest itself with high CPU utilization

Sooooooo

3. You need to find out more about what this process is doing when it hits 99%:
a) Are you swapping?
You can see this in Linux "top": if swap is non-zero; you probably need more RAM.

b) Have you hit some OTHER threshold?
Jconsole can give you clues. So can "top", "vmstat" and other tools.

c) Perhaps the resolution is to tune your application server's "JAVA_OPTS" startup options

Here are some links to look at:

http://java.dzone.com/articles/java-performance-tuning

http://www.jaysonjc.com/programming/...ning-tips.html

http://java.sun.com/developer/techni.../jconsole.html
<= Pay particular attention to #/threads, overall memory, TenuredGen and EdenGen Heap spaces
 
  


Reply


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
[SOLVED] kill all idle user processes jasonws Linux - General 3 02-19-2015 04:45 AM
Search/destroy old/idle user processes Deviathan Linux - General 2 08-06-2007 02:38 PM
Track idle processes musthafa Linux - Server 1 01-18-2007 07:20 AM
CPU idle binumvk Linux - Security 0 10-16-2004 04:19 AM
5 httpd processes running on an idle box? J_Szucs Linux - Networking 2 04-07-2003 08:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:42 AM.

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