[erlang-questions] Sending message at a specific and accurate time
Tue Feb 23 17:06:48 CET 2016
I threw every available command line option at this to see if improvement
could be seen --
erl +K true +sbwt very_long +sfwi 1 +swct very_eager +swt very_low
Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:10]
Eshell V7.2.1 (abort with ^G)
...perhaps a little, but nothing significant, unfortunately.
OSX turns out to have a rich tapestry of low latency timers:
as do FreeBSD and Linux, although their model and guarantee are a little
even Windows can be, as usual, hackily coerced:
although usleep/nanosleep would probably be strictly better and not
noticeably more intensive than select() on the unices, using Mach's
or the windows hack would put all sleeping schedulers in a busy loop, so
that would be something you might want fine grained control over.
ideally, you could do something like:
to signal to the schedulers that you want at least one thread to be running
with significantly improved timing granularity, and while at least one low
latency process existed, one or more schedulers would run under the
specific regime and bind all the low latency processes to it.
Although perhaps the erlang way is to create quick_schedulers dual to
On Tue, Feb 23, 2016 at 6:58 AM, Rickard Green <> wrote:
> Missed reply all...
> -------- Forwarded Message --------
> Subject: Re: [erlang-questions] Sending message at a specific and accurate
> Date: Tue, 23 Feb 2016 15:55:19 +0100
> From: Rickard Green <>
> Organization: Ericsson AB
> To: Tony Rogvall <>
> On 02/23/2016 02:29 PM, Tony Rogvall wrote:
>> On 22 feb 2016, at 15:55, Joe Armstrong <> wrote:
>>> On Mon, Feb 22, 2016 at 3:31 PM, Tony Rogvall <> 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 ? :-)
> The accuracy of the timeout delivered by the underlying primitive used
> (select() on macosx). It seems that the accuracy is better for short
> timeouts than long timeouts using select() on macosx.
> Using the above approach you also need a bit of luck in the smp case.
> The looping process needs to execute on the same scheduler thread as the
> scheduler thread managing the timer you want to improve.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions