Hi Mark,
> The final run sleeps for 0 seconds. Note it ran for 183936 loops,
> and used 0.78 seconds of CPU time.
Sure, waking up less often is more CPU efficient. On the other hand
sleeping for too long adds unnecessary latency (which might hurt if
this is happening in a loop).
I guess the moral of the story is that developers need to think about
how long they actually want to sleep. If something usually takes ~5 ms
on a typical machine waking up every ~1 ms might be a good compromise.
However, blindly trusting epicsThreadSleepQuantum() (which according to
the documentation is allowed to return 0) never seems to be an adequate
choice (at least not for libraries that are being used on very different
machines).
> It seems that having some idea of what the minimum effective sleep
> time is would be better than using 0, since that clearly uses a lot
> of CPU time.
I agree, epicsThreadSleep(0) only makes sense if you want to enforce a
context switch. Otherwise you better come up with a time.
-Martin
--
Martin Konrad
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: [email protected]
- References:
- epicsThreadSleep and epicsThreadSleepQuantum Konrad, Martin via Core-talk
- Re: epicsThreadSleep and epicsThreadSleepQuantum Konrad, Martin via Core-talk
- RE: epicsThreadSleep and epicsThreadSleepQuantum Mark Rivers via Core-talk
- Re: epicsThreadSleep and epicsThreadSleepQuantum Michael Davidsaver via Core-talk
- Re: epicsThreadSleep and epicsThreadSleepQuantum Konrad, Martin via Core-talk
- Navigate by Date:
- Prev:
RE: epicsThreadSleep and epicsThreadSleepQuantum Mark Rivers via Core-talk
- Next:
[Bug 608956] Re: vxWorks 6.8 deprecates the use of taskVarLib mdavidsaver via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: epicsThreadSleep and epicsThreadSleepQuantum Mark Rivers via Core-talk
- Next:
Re: epicsThreadSleep and epicsThreadSleepQuantum Konrad, Martin via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
|