The default resolution of nanosleep(3RT) of 10ms, because it is implemented using the clock interrupt. Note the following from the manpage ...

    The
    suspension  time  may  be  longer than requested because the
    argument value is rounded up to an integer multiple  of  the
    sleep  resolution  or  because  of  the  scheduling of other
    activity by the system. But, except for the  case  of  being
    interrupted  by  a  signal,  the suspension time will not be
    less than the time specified by rqtp,  as  measured  by  the
    system clock, CLOCK_REALTIME.

How are you achieving an average of 0.5 ms? I'm guessing that you have set hires_tick=1 in /etc/system (which changes the clock interrupt from 10ms to 1ms), and that you are requesting something less than 1ms.

For something less than the clock resolution, check out CLOCK_HIGHRES in timer_create(3RT). This uses a CPU cyclic timer instead of the clock interrupt. The exact resolution you are able to achieve will depend on your hardware and the way you choose to implement the sigevent handler (i.e. there will be a point beyond which the implementation overhead will be the limiting factor).

Hope this helps,

Phil


Ben Steven wrote:
Is there any _supported_ way to sleep shorter than 0.5 ms on average?

Using lock-free data structures implies waiting -> the current "nanosleep" 
functionality does not satisfy our needs because it's increasing the latency :(.

Ben
This message posted from opensolaris.org
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to