Was Mapping processes Now: ATOMS and atom_tab index

Luke Gorrie luke@REDACTED
Thu Dec 19 20:40:29 CET 2002


"Valentin" <valentin@REDACTED> writes:

> I agree that PID can be used to uniquely identify processes, and that works
> very well if the application completely lives in ERLANG and/or one part
> lives in ERLANG (i.e. server) and another in some other environment (i.e.
> CNode).

But what makes it break down in the other environments?

Note that you can turn a PID into a binary and back again:

  1> Bin = term_to_binary(self()).
  <<131,103,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,0,27,0,0,0,0,0>>
  2> binary_to_term(Bin).
  <0.27.0>

You can also turn it into a string and back again:

  3> httpd_util:encode_base64(binary_to_list(term_to_binary(self()))).
  "g2dkAA1ub25vZGVAbm9ob3N0AAAAGwAAAAAA"
  4> binary_to_term(list_to_binary(httpd_util:decode_base64("g2dkAA1ub25vZGVAbm9ob3N0AAAAGwAAAAAA"))).
  <0.27.0>

Keep in mind that this is forgeable - but so is a string naming a
registered process.

-Luke




More information about the erlang-questions mailing list