View Full Version : Forkfork!!!!!!!!!!!!!!!!!!!!!!!!!!!!
YUPAPA
July 25th, 2002, 02:47
#!/usr/bin/perl
use strict;
my $f = fork;
if (defined $f) {
if($f == 0) {
print "These are fork's children\n";
exit;
} else {
print "These are fork's parent\n";
exit;
}
} else {
print "You have no fork!\n";
}
__END__
:fork:
GregT
July 30th, 2002, 03:29
umm... what is the point of this script yupapa ? :rolleyes:
biggulp
July 30th, 2002, 07:00
how do u run it?
johnnyBoy
July 30th, 2002, 14:13
the way i understand forking is it's a way of doing 2 things seperately - 2 trains of thought as it were. creates a temporarily schizophrenic computer?! :)
it's something i need to do in php but don't know how to.
this is what i want to do and an example of how forking might be able to work? -
script A: when accessed by a user via their browser, tirggers off an automated form submission, the resoponse of which is needed for later (put into a database). the response to this submission can take a while to return - 30secs maybe. so this is where the forking comes in. one train of thought does whateve else is required and returns a page to the user quickly like usual. end of train of thought 1. in the meantime, the other train of thought goes ahead with the form submission and waits patiently for it, gets the result and sticks it into a database and ends.
script B: later accesses the result of the form submission earlier on.
what the forking allows for is the user's browser not to be left hanging, which it would be without forking.
i could have got the wrong end of the stick but i believe that's what forking is about.
and if anyone knows how to achieve it with php let me know please :)
i'm trying to do exactly what i just described above. i have everything done apart from the splitting of processing - the forking. as it is the user is left stairing at a blank screen while the browser waits for my server to finally return the requested page
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.