[erlang-bugs] cpu usage strangely high with timers on os x

Rapsey <>
Mon Dec 1 09:28:05 CET 2008


Running this simple process on a mac:

-module(tester).
-compile(export_all).

t(1000) ->
    true;
t(N) ->
    receive
        {timeout} ->
            erlang:send_after(10, self(), {timeout}),
            % timer:sleep(10),
            % self() ! {timeout},
            t(N+1)
    end.


> T = spawn(fun() -> tester:t(0) end).
> T ! {timeout}.

Will cause beam.smp process to consume 8% of cpu time as measured by the
activity monitor (or top). Using timer:sleep instead of send_after has the
same effect.
If I run this program on a windows machine, werl process will not move above
0%.
This should not be normal behavior or should it?
I'm using R12B-5 on both machines.


thank you,
Sergej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081201/ec52aaeb/attachment.html>


More information about the erlang-bugs mailing list