[erlang-questions] Subtle behaviour of Erlang scheduler

Corrado Santoro csanto@REDACTED
Thu May 24 20:21:33 CEST 2007

Hi all,

On Thu, May 24, 2007 at 08:58:32AM -0500, Jordan Wilberding wrote:
> I think this is because you are using register, which registers those 
> processes globally. As far as I know, those remain active throughout the 
> life of the shell.
No, no. If a registered process ends, the registry is updated. See this 
snap of the shell:

3> register(proc1,
    spawn (fun () -> io:format ("I am ~p~n", [whereis(proc1)]) end )).
I am <0.37.0>
4> whereis(proc1).

> We still don't understand why the same code has different behaviours
> when executed as the first function and when executed the second or
> the third time. It is also quite astonishing that a silly process as
> proc2 can *definetively* lock the scheduler, pushing out all other
> processes, including the shell.....
> I suppose we hit a serious bug...
I agree! It seems that, at the first startup of the emulator, a process 
running with a priority "high" (and without synchronization points) does 
not release the CPU, even if there are other processes with the same 
"high" priority. Indeed not a "so correct" behaviour for a round-robin 

We tried to take a look at the source code of the function "Process" in 
"erl_process.c", which performs scheduling, but, at first sight, 
everything seems ok. :-O

All the best,
--Enzo and Corrado

Eng. Corrado Santoro, Ph.D.
University of Catania - ITALY - Engineering Faculty

Tel: +39 095 7382380        VoIP: sip:7035@REDACTED

Personal Home Page: http://www.diit.unict.it/users/csanto
     NUXI Home Page: http://nuxi.diit.unict.it

More information about the erlang-questions mailing list