java uses 100% CPU and cannot be stopped

6,783

jobs only shows the processes owned by the current shell (it's a shell built-in function -- and that's why you can't run it with sudo, that runs only executable programs). It usually does not show anything unless you started it in background. See help jobs.

You can check if there are any other java processes running with:

ps aux | grep java

This searchs for any running process which has the string "java" on its command line execution, including grep. You can eliminate grep using ps aux | grep java | grep -v grep, if you want.

Also, when a process is eating a lot of CPU, you usually can spot it using the program top, pressing P to order by %CPU:

top showing a CPU intensive process

You can also use M to sort by memory usage, and use the keys < and > to change the current field used to sort.

Now, WHY a process is taking much CPU is a really hard question to answer in a generic way. It may be doing useful stuff or it may be just stuck on an infinite loop, usually only by reading the source code you could find out which. If you were to consider the Java JRE that runs the Java plugins in your browser, its CPU load is highly dependant on the nature of the program you are running.

Share:
6,783

Related videos on Youtube

32bitfloat
Author by

32bitfloat

Updated on September 18, 2022

Comments

  • 32bitfloat
    32bitfloat over 1 year

    I've encountered that the java-process is

    1. started without any reasing (while no java-application should be run) and
    2. after a while uses 100% of the CPU (AMD Phenom II X4)

    I kill it with the gnome system monitor. After some seconds, the process appears again, using again 100% of CPU (status: sleep).

    I'm also irritated about the fact, that

    $ jobs
    

    does not return anything. I'll tried

    sudo jobs
    

    for fun and got the message

    sudo: jobs: command not found

    but jobs of course is installed.

    I have installed OpenJDK Java 6 Runtime via the Software Center.

    How can I

    • find out if there is still a programm running which uses java
    • why the process takes that much CPU?
  • 32bitfloat
    32bitfloat almost 12 years
    Many thanks, somehow I mistaked jobs for top...It was freenet which, I didn't notice, started on systemstartup. I uninstalled it and now my processlist seems fine.