10 ms overhead when calling Thread.sleep on Linux

Hi,

I have been working on a traffic shaping simulation that requires me to send packets on a ms basis. When I call Thread.sleep(11) on Linux 2.4, I get a constant return around 30 ms. I tried to bypass the Thread.sleep function and called directly the select() function under linux with a timeout of 11 ms then I get a constant return around 20 ms. Then if I create a test.c program that loop 100 times calling the select(11), I get a very accurate rate around 10-11 ms. Anyone knows where that 10 ms overhead comes from? I tried executing the java program with Thread.sleep and the -XX:ForceTimeHighResolution but it doesn;t seem to change anything ! Any info would be very welcome ! Thanks

[705 byte] By [EmmaDauphina] at [2007-11-26 17:32:28]
# 1

Actually I get this behavior only on a machine with kernel 2.4. On a different machine with kernel 2.6 I get an accuracy of 10ms for a select call with 10 ms timeout. I know there was some improvements on the jiffy for kernel2.6 but I still don't get why calling select timeout 10ms from a C program return an accuracy of 10ms on linux 2.4 and the same select() timeout 10ms called from java return an accuracy of only 20 ms on kernel 2.4..... :( still looking

EmmaDauphina at 2007-7-9 0:00:29 > top of Java-index,Desktop,Runtime Environment...
# 2
HiAs you are working on traffic shaping, you must be having an idea about Jumping Window Algorithm for ATM Traffic Policing...? Can you help me plzzz
Alenp1982a at 2007-7-9 0:00:29 > top of Java-index,Desktop,Runtime Environment...