Win a copy of Rust Web Development this week in the Other Languages forum!

Thyagarajan Kathirvelu

Greenhorn
+ Follow
since Oct 27, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thyagarajan Kathirvelu

Hi,

We have a process which triggers 10 JVM process, with delay of few seconds between each process, for performing some operations on the files. Below is the snippets of the code



Below is the java version details

java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02)
Java HotSpot(TM) Server VM (build 1.5.0_19-b02, mixed mode)

The box has enough memory of 12 G when we are trying start the 10 Java process. Total memory of the box is 64 G.

Can you please let us know why this issue is occuring?
10 years ago
Thanks a lot for all your replies. It was very helpful to me.

It was certainly a bad choice to use while loop to implement a delay instead of using Thread.sleep.

11 years ago
Thanks for the response.

This code was executed in a machine having 2 Quad core CPU. A test was executed for the entire application which had this code snippet. The cpu utilisation was not high but the performance of the entire application came down. There can be around 20 threads doing the while loop.

Is the slowness caused because of invoking the System.currentTimeMillis() for 5 seconds non.stop. I know it is not the best way to implement a delay, but would like to understand which part of the code snippet is costly and why? Why would CPU hang for 5 s?

Sorry for asking very basic questions..

Thanks in advance.
11 years ago
Hi ,

I am new to java. To impement a delay of 5 s in my code I used the below code snippet instead of Thread.sleep.

Will the below code cause major performance overhead to the JVM. Is the System calls costly?

11 years ago