7

To the best of my understanding, all linux process are actually files, is it possible to copy a running process from one machine to another?

for example - copy a running tomcat server from one machine to another without having to restart the server

  • You would need clustering software. I am not knowledge able about names, or what each one does, but am aware that there is one for teleporting processes to other machines. – ctrl-alt-delor Jan 9 '17 at 14:27
7

To the best of my understanding, all linux process are actually files

You shouldn't take the metaphor too literally. Linux processes can indeed be accessed through a pseudo file system for debugging, monitoring and analysis purpose but processes are more than just these files and "copying" them from a source host /proc file system to a target /proc file system is doomed.

Is possible to copy a running process between machines?

One of the serious issues moving a running process between hosts is how to handle the open file descriptors this process is using. If a process is reading or writing a file, this very file (or an exact clone) must be available on the target host. File descriptors related to sockets would be tricky to process as the IP address they are bound to will likely change from one host to the other. Processes sharing memory segments with other ones would cease to do it after a migration. PID clashes might also happen, if a running process has the same pid that the incoming one, one of them will need to be changed. Parent child relationship will be lost, and I have just scratched the potential problems.

Despite these issues, there are technical solutions providing that functionality called "Application checkpointing" like DMTCP and CRIU. This is similar to what is used with hypervisors like VMWare, VirtualBox, Oracle VM and others when they do virtual machines live migration / teleportation. With virtual machines, the job is actually "simpler" as the whole OS is moved, including the files descriptors, the file systems, the memory, the network and other devices, etc.

  • I actually asked this question more as an exercise than as something to be tried on a real system. Looking into process "files" I found that a process has too many dependencies to just copy a file and make it work on another machine but it never hurts to ask and possibly get another view into things. thanks for your answer. – aviad m Jan 10 '17 at 7:17
  • what about docker? . edit found this criu.org/Docker – Blauhirn Dec 5 '17 at 23:50
  • @Blauhirn Indeed. I mentioned CRIU with a link where integration with OpenVZ, LXC/LXD, and Docker are mentioned. – jlliagre Dec 6 '17 at 0:24
2

No, it's not possible to move a process (i.e., a running program) from one Unix machine to another.

Some services, such as web services, database services or routers, provide redundancy options, such as failover and/or load-balancing. This means that you have several copies of the service running on several machines, and if one goes down another takes over, or they share the load of providing the service, possibly replicating databases/state between each other to keep up to date.

These kinds of services would "move" from one machine to another, while the processes that are providing the service are not moving.

This is a feature of the specific service, however, and not of Unix.

You may find more information on the ServerFault forum.

0

No, as of now its not possible. when process comes under a service. Then service to service process transfer can be possible. But this required OS level changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.