Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: They didn't give me a fork so I have to eat with a spawn.

by bart (Canon)
on Aug 23, 2002 at 20:52 UTC ( #192447=note: print w/ replies, xml ) Need Help??


in reply to They didn't give me a fork so I have to eat with a spawn.

Win32's Perl 5.6.1 does have an emulated fork(), though. Is there something wrong with that?


Comment on Re: They didn't give me a fork so I have to eat with a spawn.
Re: Re: They didn't give me a fork so I have to eat with a spawn.
by RMGir (Prior) on Aug 23, 2002 at 21:11 UTC
    Win32's Perl 5.6.1 does have an emulated fork(), though. Is there something wrong with that?

    Yup.

    If you try to fork and "spawn" off a bunch of system() calls, you get "Resource temporarily unavailable" after some fairly small number of forks (maybe 20?).

    With Win32::Process::CreateProcess, you don't run into that problem.
    --
    Mike

      Good call.

      BTW you should look into using $^X instead of the hardcoded path to perl.

      will the parent process have to wait until the child complete?
        If you use ActivePerl's fork, I believe so, since no new process is actually created.

        If you use CreateProcess, I don't think so.
        --
        Mike

Re: Re: They didn't give me a fork so I have to eat with a spawn.
by elwarren (Curate) on Aug 24, 2002 at 16:19 UTC
    I've never had much luck with ActiveState's fork. I don't even consider using it when I'm on win32. Most of my problems have been related to sockets. When a daemon accepts a connection and forks off, the socket doesn't have anything to say until the process dies. A socket that doesn't pass data isn't much use to me.

    So I just keep the servers on the servers on client stuff like this on my workstation.

    This code is more usefull for launching perl code without a dos window though, and that's why I wrote it. With this you don't have to bother hiding your dos parent in your code, it's already gone.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-07-02 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls