I'm running this extremely simple program:
class helloWorld {
public static void main(String[] args) throws InterruptedException {
while(true) {
System.out.println("Hello World!");
Thread.sleep(1000);
}
}
}
And I don't understand why the java virtual machine allocates so many processes (they have different PID), has you can see here (htop_java_helloworld.png
):
I even suspected of the instruction Thread.sleep(1000)
but the strange behavior doesn't change if it's removed.
UPDATE
I'm sorry I forgot to mention some useful details:
- the system is Debian GNU/Linux Jessie
- the JVM installed is from the package openjdk-7-jdk
- the output is from
htop
, I have filtered it with\java
so only useful processes are listed
I compiled the source code written at the beginning of the question with the command javac helloWorld.java
then I run it with the command java helloWorld
.
I run only one instance of the program and all those processes are allocated, when I kill it with ctrl+c
all the processes listed disappear, so there aren't more instances of the program running at the same time.