Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving the stack?

I'm just curious, is it possible to dump all the variables and current state of the program to a file, and then restore it on a different computer?!
Let's say that I have a little program in Python or Ruby, given a certain condition, it would dump all the current variables, and current state to a file.
Later, I could load it again, in a different machine, and return to it.
Something like VM snapshot function.
I've seen here a question like this, but Java related, saving the current JVM and running it again in a different JVM. Most of the people told that there was nothing like that, only Terracotta had something, still, not perfect. Thank you.

To clarify what I am trying to achieve:
Given 2 or more Raspberry Pi's, I'm trying to run my software at Pi nº1, but then, when I need to do something different with it, I need to move the software to Pi nº2 without dataloss, only a minor break time.
And so on, to an unlimited number of machines.

like image 869
Filipe YaBa Polido Avatar asked Dec 10 '12 20:12

Filipe YaBa Polido


People also ask

What is a stack in MIPS?

In MIPS machines, part of main memory is reserved for a stack. — The stack grows downward in terms of memory addresses. — The address of the top element of the stack is stored (by convention) in the “stack pointer” register, $sp. ▪ MIPS does not provide “push” and “pop” instructions.

What is EBP stack?

EBP aka the 'frame pointer' serves as an unchanging reference point for data on the stack. This allows the program to work out how far away something in the stack is from this point. So if a variable is two 'building blocks' away then it is [EBP+8] as each 'block' in the stack is 4 bytes.

What is stored in the stack pointer?

A stack pointer is a small register that stores the memory address of the last data element added to the stack or, in some cases, the first available address in the stack.

How does stack register work?

Stack registers in x86 SP points to current stack top. By default, the stack grows downward in memory, so newer values are placed at lower memory addresses. To push a value to the stack, the PUSH instruction is used. To pop a value from the stack, the POP instruction is used.


1 Answers

Its seams that I was trying to re-invent the wheel.
Check this links:
http://en.wikipedia.org/wiki/Application_checkpointing#DMTCP

http://www.linuxscrew.com/2007/10/17/cryopid-freeze-and-unfreeze-processes-in-linux/

like image 133
Filipe YaBa Polido Avatar answered Sep 28 '22 03:09

Filipe YaBa Polido