Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang/Scala Migrating Actors from one node to another

I got my feet wet in Actor Oriented Programming with a language called SALSA, which allows actors to move from one machine to another.

I was wondering if this was something that could be done using either Scala or Erlang which are two Actor oriented programming languages that have a lot more momentum behind them.

If either of these languages support this feature, would you please point me to some material that references how to implement something like this?

like image 554
Varun Madiath Avatar asked Oct 08 '22 14:10

Varun Madiath


1 Answers

Well, Erlang does not (afaik) allow to move processes (at the very least, the PID is tied to the node). If you want to do that for a particular function, what you can do is start a process on another node (using the rpc:call and a wrapper function, for example) and pass the state to it.

Of course, that works if you keep your state around and not in the process dictionary. And, of course, the PID of the new process will be different, but you can, for example, leave your existing process hanging and forward the messages to the new one.

like image 151
a sad dude Avatar answered Oct 17 '22 14:10

a sad dude