Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htop and top showing multiple instances of process?

I am currently running a java process with ant. I am running just one process.

When I use htop, I am seeing the following information:

enter image description here

scrolling right gives: enter image description here

basically, the middle section is comprised of just my java process.

When I do ps aux | grep java, I see:

$ ps aux | grep java
victor   27982  1.0  1.9 3799504 163112 pts/1  Sl+  02:00   0:06 /usr/bin/java -classpath /usr/share/ant/lib/ant-launcher.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar -Dant.home=/usr/share/ant -Dant.library.dir=/usr/share/ant/lib org.apache.tools.ant.launch.Launcher -cp  tag
victor   28003 19.0  6.6 3523136 544812 pts/1  Sl+  02:00   1:51 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java -Xmx2048m -classpath /home/victor/Giordano/java/lib/commons-math3-3.0.jar:/home/victor/Giordano/java/lib/guava-14.0.1.jar:/home/victor/Giordano/java/lib/joda-time-2.2.jar:/home/victor/Giordano/java/lib/postgresql-9.2-1002.jdbc4.jar -jar /home/victor/Giordano/java/build/jar/Giordano.jar 15
victor   28135  0.0  0.0   9388   924 pts/3    R+   02:10   0:00 grep --color=auto java

Any idea why there are so many instances of my process in htop?

FYI I am running on a quad core machine.

This is my build file if any of you are interested.

<project name="Giordano" basedir="." default="main">

  <!-- Keep Eclipse's bin away from our build, use separate folder -->
  <property name="build.dir" value="build" />
  <property name="src.dir" value="src" />
  <property name="lib.dir" value="lib" />
  <property name="classes.dir" value="${build.dir}/classes" />
  <property name="jar.dir" value="${build.dir}/jar" />

  <!-- Main Classes for different processes -->
  <property name="like.main.class" value="com.crowdy.learn.SimilarityLike" />
  <property name="model.main.class" value="com.crowdy.learn.SimilarityModel" />
  <property name="tag.main.class" value="com.crowdy.learn.SimilarityTag" />

  <path id="lib.path">
    <fileset dir="${lib.dir}">
      <include name="*.jar" />
    </fileset>
  </path>

  <target name="clean">
    <delete dir="${build.dir}" />
  </target>

  <target name="compile">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}" destdir="${classes.dir}">
      <classpath refid="lib.path" />
    </javac>
  </target>

  <target name="main">
    <echo>ant is not defined. Use ant like, ant tag or ant model.</echo>
  </target>

  <!-- Running Like -->
  <target name="like" depends="clean,like.run" />

  <!-- Ant properties are not mutable.
       So if we have -Ddb=xyz passed in via cmd line then this will not be defined. -->
  <property name="simThreshold" value="0.05"/>
  <property name="minFeedback" value="40"/>

  <target name="like.jar" depends="compile">
    <mkdir dir="${jar.dir}" />
    <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
      <manifest>
        <attribute name="Main-Class" value="${like.main.class}" />
      </manifest>
      <fileset dir="${classes.dir}" includes="**/*.class" />
      <zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
    </jar>
  </target>

  <target name="like.run" depends="like.jar">
    <echo>SETTING parameter simThreshold to ${simThreshold}</echo>
    <echo>SETTING parameter minFeedback to ${minFeedback}</echo>
    <java jar="${jar.dir}/${ant.project.name}.jar" fork="true" maxmemory="1024m">
      <classpath refid="lib.path" />
      <arg value="${simThreshold}" />
      <arg value="${minFeedback}" />
    </java>
  </target>

  <!-- Running Model -->
  <target name="model" depends="clean,model.run" />
  <property name="minFeedbackCount" value="15"/>

  <target name="model.jar" depends="compile">
    <mkdir dir="${jar.dir}" />
    <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
      <manifest>
        <attribute name="Main-Class" value="${model.main.class}" />
      </manifest>
      <fileset dir="${classes.dir}" includes="**/*.class" />
      <zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
    </jar>
  </target>

  <target name="model.run" depends="model.jar">
    <java jar="${jar.dir}/${ant.project.name}.jar" fork="true" maxmemory="1024m">
      <classpath refid="lib.path" />
      <arg value="${minFeedbackCount}" />
    </java>
  </target>

  <!-- Running Tag -->
  <target name="tag" depends="clean,tag.run" />
  <property name="minTagCount" value="20"/>

  <target name="tag.jar" depends="compile">
    <mkdir dir="${jar.dir}" />
    <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
      <manifest>
        <attribute name="Main-Class" value="${tag.main.class}" />
      </manifest>
      <fileset dir="${classes.dir}" includes="**/*.class" />
      <zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
    </jar>
  </target>

  <target name="tag.run" depends="tag.jar">
    <java jar="${jar.dir}/${ant.project.name}.jar" fork="true" maxmemory="1024m">
      <classpath refid="lib.path" />
      <arg value="${minTagCount}" />
    </java>
  </target>

</project>
like image 457
disappearedng Avatar asked Apr 18 '13 09:04

disappearedng


People also ask

Why does htop show multiple processes?

htop was designed to provide as much information as possible about what's going on in the system. As a result, it displays the user threads instead of hiding them. For example, system administrators can spot a problem in a multithreaded application while monitoring the CPU usage of its related threads.

What is the difference between top and htop?

It is used for displaying information about the system and its top CPU-consuming processes as well as RAM usage. htop is interactive process-viewer and process-manager for Linux and Unix-like operating system based on ncurses. If you take top and put it on steroids, you get htop.

What is htop Virt?

VIRT represents how much memory the program is able to access at the present moment. RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. ( This also corresponds directly to the %MEM column)

What does htop show?

It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage. Unlike top, htop provides a full list of processes running, instead of the top resource-consuming processes. htop uses color and gives visual information about processor, swap and memory status.


1 Answers

Htop shows Threads too. I think all these processes are threads created by your application. If you don't want to see them press shift+H.

like image 162
Don Avatar answered Sep 16 '22 17:09

Don