Hello :-), On Tue, Oct 28, 2008 at 1:12 AM, Preeti <preeti@xxxxxxxxxxxxxxxxx> wrote: > Hi > > As we know the typical entries for a process looks like this (from > /proc/self/maps) > > 08048000-0804c000 r-xp 00000000 08:02 981204 /bin/cat > 0804c000-0804d000 rwxp 00003000 08:02 981204 /bin/cat > 0804d000-0806e000 rwxp 0804d000 00:00 0 [heap] > b7cd7000-b7dff000 r-xp 00000000 08:02 1736405 > /usr/lib/locale/locale-archive > b7dff000-b7e00000 rwxp b7dff000 00:00 0 > b7e00000-b7f27000 r-xp 00000000 08:02 229670 > /lib/tls/i686/cmov/libc-2.3.6.so > b7f27000-b7f2c000 r-xp 00127000 08:02 229670 > /lib/tls/i686/cmov/libc-2.3.6.so > b7f2c000-b7f2e000 rwxp 0012c000 08:02 229670 > /lib/tls/i686/cmov/libc-2.3.6.so > b7f2e000-b7f31000 rwxp b7f2e000 00:00 0 > b7f44000-b7f46000 rwxp b7f44000 00:00 0 > b7f46000-b7f47000 r-xp b7f46000 00:00 0 [vdso] > b7f47000-b7f5c000 r-xp 00000000 08:02 212578 /lib/ld-2.3.6.so > b7f5c000-b7f5e000 rwxp 00014000 08:02 212578 /lib/ld-2.3.6.so > bfdf6000-bfe0b000 rw-p bfdf6000 00:00 0 [stack] > > If I want to stop a running process and restore it later (ie checkpoint and > restore), is it possible to do so by using these virtual memory mappings? If > so, can someone tell how to go about it? > another terminology is hibernation (using s2disk) and suspend (using s2ram), and tools described here: http://lwn.net/Articles/263620/ My Ubuntu 7.04 (kernel 2.6.20) supports s2disk very well....as I hibernate everyday. >From dmesg: [57877.668000] pcieport-driver 0000:00:01.0: LATE freeze [57877.668000] agpgart-intel 0000:00:00.0: LATE freeze [57877.668000] swsusp: critical section: [57877.668000] swsusp: Need to copy 117978 pages [57877.668000] swsusp: Normal pages needed: 110167 + 1024 + 24, available pages: 136315================>end of s2disk is here. [87386.668000] agpgart-intel 0000:00:00.0: EARLY resume==============>start of resuming.....after power-on button is pressed. [87386.668000] pcieport-driver 0000:00:01.0: EARLY resume [87386.668000] uhci_hcd 0000:00:1d.0: EARLY resume [87386.668000] uhci_hcd 0000:00:1d.1: EARLY resume [87386.668000] uhci_hcd 0000:00:1d.2: EARLY resume [87386.668000] uhci_hcd 0000:00:1d.3: EARLY resume snip [87387.228000] Restarting tasks ... <6>usb 4-2: USB disconnect, address 2=========>last part is to restart all the processes, after all devices is enabled. [87387.516000] done. The codes for implementation of process restart is: void thaw_processes(void) { printk("Restarting tasks ... "); thaw_tasks(true); thaw_tasks(false); schedule(); printk("done.\n"); } in kernel/power/process.c. and in kernel/power/disk.c:hibernation() is the start of hibernation process. Details described here: http://lwn.net/Articles/274008/ as for saving all the registers information, lookup arch/x86/power/hibernat* files: ENTRY(swsusp_arch_suspend) movl %esp, saved_context_esp movl %ebx, saved_context_ebx movl %ebp, saved_context_ebp movl %esi, saved_context_esi movl %edi, saved_context_edi pushfl popl saved_context_eflags call swsusp_save ret for saving of memory (snapshotting) it is done not at the process level (which is VMA memory), but saving the physical pages to swapfile itself: kernel/power/snapshot.c: asmlinkage int swsusp_save(void) { called from: arch/x86/power/hibernate_asm_64.S: call swsusp_save arch/x86/power/hibernate_asm_32.S: call swsusp_save checkpoint and restart is described here (and this is something very new to me....not even sure it is available yet??????) http://lwn.net/Articles/293575/ http://lkml.org/lkml/2008/10/16/354 but the idea is to freeze a process and restore the entire process on another machine, finer granularity than the virtual machine implementation. correct? sorry i may be wrong....:-). -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ