Gnanam
Gnanam

Reputation: 10923

JVM and Java Linux process

This question may be very basic about Java JVM. If I've a Java standalone program and if, for example, 5 processes of this program are running at a particular time in the server, can we say that these 5 java processes are running in 5 JVMs?

By process, I mean the Linux process here. If I execute ps -ef |grep java, I'll see 5 java processes showing up.

Upvotes: 8

Views: 24424

Answers (3)

CruiZen
CruiZen

Reputation: 182

You can run the jps command (from the bin folder of JDK if it is not in your path) to find out what java processes (JVMs) are running on your machine.

Upvotes: 5

Jé Queue
Jé Queue

Reputation: 10637

Depends on the JVM and native libs. You may see JVM threads show up with distinct PIDs in ps. Generally speaking the child PIDs will have parent PIDs with java processes as those that are threads.

You cannot say for sure that the # of Linux java processes == # of instantiated JVMs.

Upvotes: 0

Matthew Flaschen
Matthew Flaschen

Reputation: 285027

Yes, that's correct. There is one JVM per java process.

Upvotes: 12

Related Questions