Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JVM and Java Process

Tags:

java

process

jvm

This might be a very basic query about Java JVM. If I've brought up 2 separate programs using a bash script, 2 processes are running and I can see the processes using ps -ef command.

Does that mean they are running as 2 separate JVM's? I have this query, since I can see that the parent process id (PPID) is same for both the processes.

like image 271
ASD Avatar asked Feb 25 '26 11:02

ASD


2 Answers

Does that mean they are running as 2 separate JVM's?

Yes. The 'java' command starts a JVM.

like image 51
a guest Avatar answered Feb 27 '26 01:02

a guest


Yes, both are two completely separate JVMs running as native OS processes. This includes garbage collector, JIT compiler, and all the other usual stuff.

Each OS process has a parent, if nothing else, then it's the "init" process that starts as the first thing when the OS is booting.

Btw. Java command line tools, notably jcmd are really good for exploring java/jvm processes on your machine - e.g. you can just type jcmd to list all of them; type jcmd <PID> help to check list of available commands for specific process.

htop is another good tool to explore process hierarchy.

like image 38
Juraj Martinka Avatar answered Feb 27 '26 00:02

Juraj Martinka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!