[erlang-questions] erlang:send_after accuracy on os x

Scott Lystig Fritchie fritchie@REDACTED
Tue May 5 19:04:32 CEST 2009


Camille Troillard <tuscland@REDACTED> wrote:

ct> I would be curious to know why timers are such a big problem in
ct> Erlang.

It's probably not the VM's problem: it's a matter of the resolution of
interrupts provided by the OS.  FreeBSD has historically used a 100Hz
timer, which gives a minimum resolution of 10ms.  My guess is that OS X
uses the same frequency.  In Linux land, the timer resolution is defined
at compile time, and newer kernels also provide the "tickless" option.

As Sergej has discovered, using a different system call can indeed yield
finer resolution.  But IIRC usleep() isn't safe to use in multithreaded
apps.

-Scott



More information about the erlang-questions mailing list