Re: freezing a process




Dances With Crows wrote:
On Mon, 09 Oct 2006 00:12:27 -0400, CBFalconer staggered into the Black
Sun and said:
"gaetanoortisi@xxxxxxxx" wrote:
Is [it] possible to suspend a process, [save] the ram (and swap) it
used and restart it after the pc has turned off and rebooted?
I'm not speaking about [suspend-to-RAM or suspend-to-disk] but only a
single process
Please limit your line length to 72 chars max, although 65 is better.
This will avoid the nasty wraps that are showing up above.

What wraps? The OP's NNTP client was putting out lines of ~70 chars
followed by lines of ~30 chars. It looked weird, yeah, but it wasn't
the problem you described.

A [moment's] thought should show that this is not feasible. The
memory allocated to a process is full of pointers, all of which are
invalid when the memory is reloaded elsewhere. Any such suspend
operation would have to know exactly where each such pointer was
stored and its relationship to the program as a whole.

This is true, unfortunately. Using suspend-to-RAM or suspend-to-disk
saves *everything*, which avoids the pointer trouble that CBFalconer
mentioned. If you try to do this for just one process, you will almost
certainly run into trouble with the vtables.


I think that if a program could be swapped and return to memory there
must to be a way to do this. (segmentation and paging are made to
keep a program with its addresses *indipendent* to where it is located
in memory, imho)

A program can know what its state depends on, and thus store and
restore that state. The system cannot.

The vast majority of programs that need to do it can already save their
states and restore them with minimal hassle. The OP should post the
name of the program he'd like to save/restore, so that people who've
used that program can offer advice on how to make it behave the way he
wants. If the program's a piece of custom code he wrote, he should
write up a couple of save() and restore() functions.


No, my idea is this: supposing you have some tediuos works like, mmhh,
encoding mp3 files or compiling large sources. You could make a program
that (re)start this processes when you left the computer (like a
screensaver
does) and stop after you come back. However, in my vision of the
project, all this works must have the possibily to be interrupted when
you
halt your pc (It could be annoying to have to left your pc on 'cause it
has to
complete its homeworks). And more, you could put all the works that
need to
be done in a file where this program read and chew, chew when the pc
doesn't
have to do useful things.

.



Relevant Pages

  • Re: save dup restore
    ... first allocates a descriptor in VM ... packs a pointer to the descriptor in to a save object ... it depends on your memory management. ... Restore then simply rewinds the memory manager, ...
    (comp.lang.postscript)
  • Re: freezing a process
    ... Please limit your line length to 72 chars max, ... which avoids the pointer trouble that CBFalconer ... states and restore them with minimal hassle. ...
    (comp.os.linux.misc)
  • Re: size of pointer variables
    ... For instance an image-processing routine that takes an array of unsigned chars as its argument would now gobble four times as much memory as necessary, ... But if our addresses are multiples of 32 bits, we need to tag on an extra two bits to tell us where the pointer points to. ... declaring a pointer variable "void *", can I declare it as "char *" and then later on typcast it to whatever type as needed. ...
    (comp.lang.c)
  • Re: Differance between Array and Pointers
    ... a pointer is a variable in memory that contains the address of ... to load it from memory into a register, then use it to load the ... An array is the big chunk of memory itself. ... initially contains the address of an array of chars which takes up 6 ...
    (comp.arch.embedded)
  • Re: std::string convertion
    ... > Detlef wrote: ... > You can use c_strto get a pointer to a contiguous piece of memory that is ... > sizechars long. ... c_strwill give you a pointer to a contiguous piece of ...
    (microsoft.public.vc.stl)