[erlang-questions] gen_server vs gen_fsm

Ulf Wiger <>
Mon Oct 8 22:16:46 CEST 2007

2007/10/8, YC <>:
> Interesting - are you saying erlang processes can be serialized to say
> Mnesia and revive later?  If that's doable it's certainly a very intriguing
> technique.  Can you point me to some examples/guides on how this is done?

You can't save the actual process, but you can pretty easily save the
state data of the process. The thing to keep in mind is that PIDs will
change, since it's actually a brand new process after revival.

If your process is a gen_server, the thing that needs saving could
be the whole state variable; for a gen_fsm, it might be the {State, Data}
tuple. You may want to write pack()/unpack() functions that compress
the state somewhat, e.g. removing things that aren't needed for
restoring the process later.

Ulf W

More information about the erlang-questions mailing list