[erlang-questions] Persistent processes
Tue Jul 10 15:46:14 CEST 2007
Kirill Zaborski wrote:
> Is there some way to do subj? I.e. I'd like to spawn a process, then I
> turn off Erlang emulator and just before that I write the state of the
> process to the disk. I see erlang:hibernate and sys:suspend but no
> info about processes surviving emulator restart.
> The question may seem strange but how can I implement such a behaviour?
as far as I know there is no BIF that can do that. But
process in question can store persistent portion of its
state in a mnesia table (identified by unique address)
after each checkpoint (for example after each request
or after some period of time). Then you can have another
(ram_copies) table which maps addresses to actual process
pids. If the process state table is of type disc_copies
you have persistent processes.
At least this is how we are doing it (work still in progress).
Hope this helps,
More information about the erlang-questions