Jump to content
Excelsior Forums
orasis

sleep() resolution on Linux?

Recommended Posts

Hello, I need to implement an application that does 250 microsecond sleeps in between sending out UDP packets.  I am unable to do this with Sun's JDK as the sleep resolution is around 10-15ms.  Also, does JET implement the System.nanoTime()?  How low of a resolution does it go to on Linux?

Share this post


Link to post
Share on other sites

It seems you have to write and use native functions (through JNI) those increase system timer's resolution (by invoking corresponding OS functions). For Windows, system timer resolution can be adjusted by TimeBeginPeriod/TimeEndPeriod functions.

However, it seems you application is rather real-time. And Java is indeed a bad choice for real-time applications, for example, because of garbage collector pauses.

Share this post


Link to post
Share on other sites

×