Jan 22, 2003, 2:30 AM
Post #1 of 3
I've been programming in Perl for a while now, but just recently have had the reason to use fork(). I have gone to quiet a few sites, and poured through the multiple books I have on Perl, but just can't get this into my thick skull. I learn by seeing and reversing code (usually).
Can Demonstrate simple fork()
Anyway, my request. A simple program that would do basically this:
Start a parent, print [Parent]
fork/start child process print [Child]
the child process would sleep for 10 seconds then assign $i =1;
while the child is sleeping, the parent would print "waiting\n";sleep 1; (so i would get 10 "waiting" messages
once $i is assigned 1, child would print [Child End]
parent would print [Parent End]
I apologize if this comes off as a little trivial, but I have been banging my head, fighting zombies, and trying to understand significances of waitpid for about 3 days now. Anyway, any help would be greatly appreciated as I would be able to work through how fork goes through the motions with a simple program like listed above.