Hi,
i recently discovered a strange behaviour regarding sleep on my machines that i wanted to share. Maybe somebody has an idea what causes this. Here we go:
Consider an endless loop doing nothing but a Thread.sleep(20). How many times can it do this in 1 sec?
On my old Celeron 1Ghz/XP/Java 1.4.2, the answer is 50 (as expected)
On my P4HT 3.2Ghz/XP/Java 1.4.2/Java 1.5, the answer is 33 (for both VMs)
On my PII-400/Debian Linux/Java 1.4.2, the answer is 33.
So far, so good. I changed the value to 19 instead and got 52 on the Celeron, 36 on Linux…but i got 52 on the P4 too. After changing it to 21, i got 48 on the Celeron, 48 on the P4 and 28 on Linux.
I would be able to understand that, if the Celeron would always be correct and Linux and the P4 won’t for whatever reason…but why is the P4 like the Celeron for 19 and 21 and like the Linux machine for 20 ???
Any ideas?