in reply to Synchronizing Multiple System Processes

There is an awful lot of ... misunderstanding going on in this thread, and it is mostly caused by you wrongly describing the problem. Until you post the scripts that I can run that demonstrate the problem you are describing, I do not believe what you are saying is happening is possible.

For example, save the following three scripts and run them, and barring some external influence, like disk full, disk failure, or a third party piece of software taking exclusive access to the interchange file, it will run forever without errors.

##609823.pl #! perl -slw use strict; my $count; while( 1 ) { print "Iteration: ", ++$count; system 'perl 609823-1.pl'; system 'perl 609823-2.pl'; } ## 609823-1.pl #! perl -slw use strict; my $count = int rand 100; open OUT, '>', 'output.txt' or die $!; print OUT 'A line of junk' for 1 .. $count; close OUT; printf "Wrote $count lines \t"; ## 609823-2.pl #! perl -slw use strict; open IN, '<', 'output.txt' or die $!; my @lines = <IN>; printf "Read %d lines \t", scalar @lines; close IN; unlink 'output.txt'; ## Produces c:\test>609823 Iteration: 1 Wrote 72 lines Read 72 lines Iteration: 2 Wrote 19 lines Read 19 lines Iteration: 3 Wrote 97 lines Read 97 lines Iteration: 4 Wrote 58 lines Read 58 lines Iteration: 5 Wrote 94 lines Read 94 lines Iteration: 6 ...

All of which is just a long winded way of saying: There is something that you are not telling us going on here, and the quickest way of clarifying what that might be, is for you to show use the contents of the script you are using, rather than hypothetical equvalents which obviously aren't.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Synchronizing Multiple System Processes
by neversaint (Deacon) on Apr 14, 2007 at 15:10 UTC
    Dear BrowserUk,
    .... rather than hypothetical equivalents .....
    Yes, you are right. I was presenting the simplified problem there. Because there are too many scripts involved in my main.
    Exposing each one of them, I fear may just confusing the reader.
    Anyway I will look again the detail of each related scripts individually.
    I'm really sorry if I have caused such confusion.


    ---
    neversaint and everlastingly indebted.......

      Simplified is good, but only so long as the simplification continues to exhibit the problem. I agree that posting too many scripts would detract people from trying to help, but there must be a point where one script (or a script called from it), writes the file, and the next script fails to be able to access it. Try isolating the writer and the reader and examining what happens at that point.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.