Skip to contentSkip to conversation

Suspending and resuming a single task

DISCUSSION Wojciech Moczulski 3 participants 5 messages Jun 19, 2006

lore
Share & tools
lore
#0 lore raw

Hello,

I'm doing some research on suspending/resuming a single task in Linux 2.6.x. At this point I've succeded dumping the whole task state (CPU context, regs, memory, fds, etc.) to an external file and reading it back to a pre-defined structure (I know that reading/writing files directly to/from kernel is a bad thing - I'm working *only* on a p.o.c. and currently there's no other purpose), but I'm stuck in getting restored task to get running again.

Are there any ways to re-register restored task as a running one in some "easy" way or should I perform some manual modyfications to the kerenel structures?

Can anyone suggest me some solution to this problem?

Regards,
Wojciech

PS. I'm not on a list so please CC me, please.

#2 lore raw

Matthew Garrett napisał(a):

Quoted 1 line

http://cryopid.berlios.de/ ?

OK, and if I want to parse the path to a file, where process state is saved, to the kernel and let the kernel module restart the process? Is it possible to do it this way (without building self-executable binary)?

Regards,
Wojciech

#3 lore raw
Quoted 6 lines · Wojciech Moczulski

Matthew Garrett napisał(a):

Quoted 1 line

http://cryopid.berlios.de/ ?

OK, and if I want to parse the path to a file, where process state is saved, to the kernel and let the kernel module restart the process? Is it possible to do it this way (without building self-executable binary)?

One of the earlier incarnations of CryoPID did more or less this - it generated an ELF file with segments as laid out in the original image, so that the kernel ELF loaded did all the dirty work. It still required an extra portion of code to be injected into the binary in order to restore registers, file descriptors, etc. I recall the main reason I switched away from it was to be able to compress the images.

If you're going to be modifying the kernel in order to resume processes, then implementing it as an binary format handler (fs/binfmt_*) may be what you're looking for.

Regards,

Bernard.

#4 lore raw

Bernard Blackham napisał(a):

Quoted 18 lines · Wojciech Moczulski
Quoted 8 lines

Matthew Garrett napisał(a):

Quoted 1 line

http://cryopid.berlios.de/ ?

OK, and if I want to parse the path to a file, where process state is saved, to the kernel and let the kernel module restart the process? Is it possible to do it this way (without building self-executable binary)?

One of the earlier incarnations of CryoPID did more or less this - it generated an ELF file with segments as laid out in the original image, so that the kernel ELF loaded did all the dirty work. It still required an extra portion of code to be injected into the binary in order to restore registers, file descriptors, etc. I recall the main reason I switched away from it was to be able to compress the images.

Quoted 3 lines

If you're going to be modifying the kernel in order to resume processes, then implementing it as an binary format handler (fs/binfmt_*) may be what you're looking for.

I must say I didn't thought of it in this way. First version of my concept assumned storing task state, restoring it later and get it running by creating a new process by hand and rewriting necessary data.

Well, thank anyway.

Regards,
Wojciech