We don't bite newbies here... much | |
PerlMonks |
Concurrency : FORK and knifeby jsl (Initiate) |
on Jun 15, 2001 at 20:58 UTC ( [id://88852]=perlquestion: print w/replies, xml ) | Need Help?? |
jsl has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks.
By the way, is Monks short for Monkeys? Today's question is ... I would like to know how the multiprocessing works, when used in Perl function, FORK(). I tried doing this ... written in pseudo-code What I want to do is, let the parent write at SLEEP(1) and let the child read at SLEEP(3) output : 'ALPHA' and let the parent write at SLEEP(5) and let the child read at SLEEP(7) output : 'ALPHA' 'BETA'. But of course, thank Perl God, it doesn't work. But what does work is ... In this program, it opens and closes every time you want to read or write to a file. So it seems that given one FILE, two processes cannot access the FILE at the same time. My 'theory' correct? Any better idea than this continual opening and closing file when reading and writing to a file? G'day jsl
Back to
Seekers of Perl Wisdom
|
|