0

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.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

This is really interesting. So the "java -version" is not so light as it appears.:) Actually this curiosity started with the performance issue of some monitoring scripts (in Linux) which runs some shell scripts to get the status of some processes (using "ps"). This shell script is called multiple times every minute for each product we are monitoring. During this time the CPU is at 100%.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.