addressing a lot of processes

Ulf Wiger ulf@REDACTED
Sun May 22 10:55:06 CEST 2005

Den 2005-05-22 00:35:22 skrev Sean Hinde <sean.hinde@REDACTED>:

> One common solution is to maintain a named protected ets table of IP  
> Addr -> Pid. Looking up in an ets table is pretty much the same as  
> looking up in an "erlang internal table", and the calling process can do  
> it directly:
> case ets:lookup(mapper, {127,0,0,1}) of
>      [{_, Pid}] ->
>          Pid ! { processNewData, SomeData };
>      [] ->
>          Pid = createAndRegisterNewProcess({127,0,0,1}),   %% This  
> should make a call to the ets table owning process to insert the new  
> entry
>          Pid ! { processNewData, SomeData }
> end
> OTOH if you know you will have a bounded set of IP addresses then your  
> atom scheme is OK also
> Sean

In a previous post:

I mentioned a process registry that's available in Jungerl.
It allows you to register any erlang term to a process,
have multiple registered names for a single process, and
also register shared names, e.g. in order to address process
as a group. There are also functions to fold over a set of
registered processes. Performance is quite good, and I think
you'd need to have some pretty heavy performance requirements
not to afford it, esp. considering the advantages it brings
in debugging and programming ease.


More information about the erlang-questions mailing list