Hello everyone,
(Please correct me if this is the wrong list for my proposal.)
I was wonder if it would be possible / usefull to add a hibernation
functionality to the Perl 6 Language, possibly via a Module.
(but the core would have to provide the needed low level functions)
"Hibernate" would simply be a funny kind of fork.
The "child process" is not created instantly, instead the
user has to start the "child process" at a later time, using
some kind of binary image created at hibernation time.
The binary image should represent the interpreters
internal state and the compiled bytecode, as straight
as possible.
example:
if (my $binary = hibernate) {
print "Feelin sleepy... Good Night.";
save_to_disk($binary, "~/myscript.pl.sleeps");
exit;
} else {
print "Im awake !";
}
# perl myscript.pl
Feelin sleepy... Good Night.
# perl myscript.pl.sleeps
Im awake !
Of course, the delicate things like open file handles, permissions... would
have to be handled by a supporting Module.
Perhaps this is usefull for:
- Scripts that are run by crond. If there is a problem (i.e no database
connection),
they could simply hibernate and resume the next time they get called where
they left off.
- CGI Scripts could hibernate instead of exiting, when the request is done.
(goal: minimal overhead to restart even outside mod_perl)
And, a hole Session (many pages/one user) could be served with just one
perl scirpt,
hibernating between requests.
- of advanage if ever a hole OS is beeing written in Perl (hey, you never
know...)
- And of course it would be a nice challange ;-)
Perhaps not usefull at all.
Any toughts ?
Thomas