[erlang-questions] Sending message at a specific and accurate time
Tue Feb 23 14:29:35 CET 2016
> On 22 feb 2016, at 15:55, Joe Armstrong <erlang@REDACTED> wrote:
> On Mon, Feb 22, 2016 at 3:31 PM, Tony Rogvall <tony@REDACTED> wrote:
>>> L = fun Loop() -> receive after 1 -> Loop() end end.
> Busy sleep :-) < I thought busy waiting was frowned upon>
> Actually after 10 works as well.
When running a busy sleep loop of 1 ms I get a 990 us diff from the actual time
and when running a busy loop of 10 ms I get 1550 us diff.
BTW The same is true for smp disable
Question for Richard really is why ? :-)
Is 10 ms to small amount of time to allow the schedulers to sleep?
The cpu load for a busy loop 10 ms is about 2%
and busy loop 1 ms is 8%
This sound a lot for doing nothing, but maybe not that much for doing something
important at the right time now and then?
The problem might go away if running this on a slightly loaded node on a multi core machine.
> So a work-around is to set the timer 10 ms *before* I want and run a busy sleep
> loop -
> So I keep having to thumping the damn thing to make it doesn't fall asleep.
> I've only tested on an unloaded system - perhaps if the system was loaded
> the timings would be better?
> Thanks for the tip.
>> That is a process doing minimal sleep, but still sleeps ( I think )
>> Adding this little ”helper” process changes the timing on my mac to the better.
>> From 3-4 ms latency to to around 1 or less.
>> Power cable did not affect the latency for me either.
>>> On 22 feb 2016, at 13:19, Jesper Louis Andersen <jesper.louis.andersen@REDACTED> wrote:
>>> On Mon, Feb 22, 2016 at 1:16 PM, Ola Bäckström <Ola.Backstrom@REDACTED> wrote:
>>> Do you get different result with power cable plugged in compared to not plugged in?
>>> I controlled for that by trying it with and without the cable plugged. It isn't affecting the latencies.
>>> Any kind of dynamic timing system shouldn't really affect this either. If anything it ought to improve the precision.
>>> erlang-questions mailing list
>> erlang-questions mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
More information about the erlang-questions