Prateesh
Prateesh

Reputation: 13

High CPU usage when running several "java -version" in parallel

This is just out of curiosity to understand

i have a small shell script

for ((i = 0; i < 50; i++))
do
java -version &
done

when i run this my CPU usage report by sar is as below
07:51:25 PM CPU %user %nice %system %iowait %steal %idle
07:51:30 PM all 6.98 0.00 1.75 1.00 0.00 90.27
07:51:31 PM all 43.00 0.00 12.00 0.00 0.00 45.00
07:51:32 PM all 86.28 0.00 13.72 0.00 0.00 0.00
07:51:33 PM all 5.25 0.00 1.75 0.50 0.00 92.50

As you can see, on the third line the CPU is at 100%
My java version is 1.5.0_22-b03.

Upvotes: 0

Views: 408

Answers (1)

Adrian Regan
Adrian Regan

Reputation: 2250

It's pretty much what you would expect. 50 Java Virtual Machine instances loading at the same time, each one, performing all it's basic initialization code (reserving heap memory, loading core class libraries and initializing them, starting the garbage collector, etc). It's pretty good performance too considering, 2 seconds.

type this command in your shell :

java -verbose -version

The output is quite interesting....

Upvotes: 3

Related Questions