Whas is the difference between forked process vs external command in this case.

G

grocery_stocker

Taken from Open3
" Note if you specify "-" as the command, in an analogous
fashion to "open(FOO, "-│")" the child process will just
be the forked Perl process rather than an external com­
mand. This feature isn't yet supported on Win32 plat­
forms."


Okay, what is the big deal if the this is a forked process vs an
external command? I really can't think
of situtation and/or program off the top of my head where this would
matter.

Chad
 
R

Randal L. Schwartz

grocery> Okay, what is the big deal if the this is a forked process vs an
grocery> external command?

forked process: still running perl code from the same program
external command: brand new data and code
 
X

xhoster

grocery_stocker said:
Taken from Open3
" Note if you specify "-" as the command, in an analogous
fashion to "open(FOO, "-=E2=94=82")" the child process will just
be the forked Perl process rather than an external com=C2=AD
mand. This feature isn't yet supported on Win32 plat=C2=AD
forms."

Okay, what is the big deal if the this is a forked process vs an
external command?

Well, they do very different things.
I really can't think
of situtation and/or program off the top of my head where this would
matter.

You can't? Let's say the other program is "ls". If you do the plain fork
instead of starting the external "ls" command (which is probably
implemented as the combination of fork followed by an exec) , then the
other program is not "ls", it is perl. That seems like a big difference to
me. I rarely confuse perl with ls. On the other hand, let is say the
other program is perl. If you use the forking method, then the new process
has a copy (COW) of all the old process's data, and all the old process's
modules are already loaded (which is often a good thing, and sometimes a
bad thing, for example if you have objects holding connections to servers
that clean up on exit, it may clean up when the child exits while the
parent is still expecting to use them), and the code is already compiled.
And (I suspect) it is a lot faster to fork than to start up a whole new
interpreter from scratch by forking and then execing (and compiling...)

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top