gpt4 book ai didi

java - htop 和 top 显示进程的多个实例?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:59:18 26 4
gpt4 key购买 nike

我目前正在使用 ant 运行一个 java 进程。我只运行一个进程。

当我使用 htop 时,我看到以下信息:

enter image description here

向右滚动给出: enter image description here

基本上,中间部分只是我的java进程。

当我执行 ps aux | grep java,我看到了:

$ 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

知道为什么我的进程在 htop 中有这么多实例吗?

仅供引用,我在四核机器上运行。

如果你们有兴趣,这是我的构建文件。

<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>

最佳答案

Htop 也显示线程。我认为所有这些进程都是您的应用程序创建的线程。如果您不想看到它们,请按 shift+H。

关于java - htop 和 top 显示进程的多个实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16078883/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com