Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Per IPC

by sourav007 (Initiate)
on Jul 11, 2013 at 12:55 UTC ( #1043716=perlquestion: print w/ replies, xml ) Need Help??
sourav007 has asked for the wisdom of the Perl Monks concerning the following question:

Thanks for the reply FIFO means named PIPE mechanism you are telling to implement? Yes I am facing the problem with buffer for that the child process is hanging after some time. Please can you help me how to flush the buffer when it is filled up as the child process needs to continuously write to the pipe handle. As I am having two separate scripts and I am to trying initiate the execution of one script(child process) from another script(parent process) using pipe mechanism such as open($fh, '-|', "./monitor.pl") here monitor.pl is the child process such that both of them executes asynchronously and at the same time as well as the output of the commands placed inside the while loop of the child process are written to the pipe handle continuously for that reason the buffer is getting filled up. So please suggest me the mechanism and appropriate location to flush the buffer such that the child process never hangs up as the buffer fills up.

Comment on Per IPC
Re: Per IPC
by The_Dj (Novice) on Jul 12, 2013 at 03:46 UTC
    I think you've mixed your terms but if I understand:
    you want to run a child process that sends data to the parent process.
    They should run at the same time
    But the child stops writing output after a while.


    If I understand, then:
    Does the parent need the output of the child?
    If not, use fork and exec.
    If it does, the child is probably hanging when its output buffer is full. Try using a FIFO.
      Thanks for the reply FIFO means named PIPE mechanism you are telling to implement? Yes I am facing the problem with buffer for that the child process is hanging after some time. Please can you help me how to flush the buffer when it is filled up as the child process needs to continuously write to the pipe handle. As I am having two separate scripts and I am to trying initiate the execution of one script(child process) from another script(parent process) using pipe mechanism such as open($fh, '-|', "./monitor.pl") here monitor.pl is the child process such that both of them executes asynchronously and at the same time as well as the output of the commands placed inside the while loop of the child process are written to the pipe handle continuously for that reason the buffer is getting filled up. So please suggest me the mechanism and appropriate location to flush the buffer such that the child process never hangs up as the buffer fills up.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1043716]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-07-11 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (221 votes), past polls