On 03/13/2016 02:14 PM, Peter Scott wrote:
> On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote:
[snip]
>> What modification can prevent zombies yet allow multiple concurrent
>> clients to attach?
>
> You need the WNOHANG option on your wait() to make it nonblocking.
Thanks. I've been
On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote:
> The snippet below works to fork as a specific user, if run as root.
> However, it generates zombies. The functions wait() or waitpid() seem
> to be available to use to stop that, but if I insert either of them in
> the outer while loop,
Thanks, David and Shlomi (and those that read),
I understand fork() and the style of writing better. Strange that the
defaults for 'use English' are not optimal.
The snippet below works to fork as a specific user, if run as root.
However, it generates zombies. The functions wait() or waitpid()
Hi Lars,
some comments on your code:
On Fri, 11 Mar 2016 20:22:34 +0200
Lars Noodén wrote:
> If I have the code below to fork a child process, how would the right
> way be to fork as a different user? I gather that fork() itself does
> not support that, so some other
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
Hello all.
AFAIK, you can't do that. When you fork everything is copied, including
the UID.
To achieve something similar, you need to launch another process (but
you'll need to be root to launch it as another user)
Regards,
David Santiago
On
If I have the code below to fork a child process, how would the right
way be to fork as a different user? I gather that fork() itself does
not support that, so some other method must be used.
Regards,
Lars
-
#!/usr/bin/perl
use strict;
use warnings;
use English;# for $UID and such
my
Hi,
I'm working on a forking process and I need a way to check if any of the
processes have failed and if they have restart them. Can anyone point me in
the right direction to a tutorial or explanation of how to do this?
Thanks in advance,
Graeme
Hi Graeme,
On Fri, 10 Aug 2012 10:10:10 +0100
G M iamnotregiste...@hotmail.com wrote:
Hi,
I'm working on a forking process and I need a way to check if any of
the processes have failed and if they have restart them. Can anyone
point me in the right direction to a tutorial or explanation
Hi,
I'm working on a forking process and I need a way to check if any of the
processes have failed and if they have restart them. Can anyone point me
in the right direction to a tutorial or explanation of how to do this?
Or use a server framework like POE which manages forking for you
On 08/10/12 02:10, G M wrote:
I'm working on a forking process and I need a way to check if any of the
processes have failed and if they have restart them. Can anyone point me in
the right direction to a tutorial or explanation of how to do this?
Network Programming with Perl by Lincoln D
And the book Network programming with Perl is a good book for Perl
client/server development including the fork stuff.
-Original Message-
From: dery...@gmail.com
Sent: Wed, 15 Jun 2011 13:11:38 -0700 (PDT)
To: beginners@perl.org
Subject: Re: perl process forking tutorial
Hi there,
can somebody recommend a good tutorial web link and/or URL for learning
perl forking please?
Cheerss
Noah
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On Jun 15, 11:21 am, noah-l...@enabled.com (Noah) wrote:
Hi there,
can somebody recommend a good tutorial web link and/or URL for learning
perl forking please?
Presumably, you've already seen these docs:
perldoc perlipc
perldoc perlfork # fork emulation for non-Unix
Not the best
Hi,
I plan to implement a threading or forking http server to receive
client request,after handling the requested url,it gives out new urls.
What is the better module to use?
Thank you for any suggestions.
--
XUFENG
2009-07-06
2009/7/6 XUFENG xufeng...@sina.com:
Hi,
I plan to implement a threading or forking http server to receive
client request,after handling the requested url,it gives out new urls.
What is the better module to use?
A perl module or httpd module?
for perl module, could use CGI.pm
XUFENG == XUFENG xufeng...@sina.com writes:
XUFENG Hi,
XUFENG I plan to implement a threading or forking http server to
receive client request,after handling the requested url,it gives out new urls.
XUFENG What is the better module to use?
XUFENG Thank you for any suggestions
Hi List
I am trying to write a code which will work as self monitoring script. The
parent will work for something and child will check that parent program is
running or not . If parent is not running or somehow killed or crashed then
child will restart the parent . But I am not getting the
Anirban Adhikary wrote:
Hi List
Hello,
I am trying to write a code which will work as self monitoring script. The
parent will work for something and child will check that parent program is
running or not .
You want to do that the other way around. The child will do the work
and the
I'm utilizing fork for the first time, and am having an issue which I
can't track down.
I've made a test program at http://jeremy.kister.net/code/ftest.pl to
demonstrate. I expect this program to print 'SQL RESULT: 1' for as long
as it can.
SQL RESULT: 1
SQL RESULT: 1
SQL RESULT: 1
On 5/8/2007 6:46 PM, Jeremy Kister wrote:
I'm utilizing fork for the first time, and am having an issue which I
can't track down.
I sent this original email with a bad return address. Four and a half
hours later, when the post still didnt make it to the list, I realized
that the I had used a
On 5/9/07, Jeremy Kister [EMAIL PROTECTED] wrote:
On 5/9/2007 12:01 AM, Jeff Pang wrote:
1) too less timeout setting in my.cnf? see /etc/my.cnf and look for this line:
I actually have no my.cnf. But if I s/my $pid = fork()/my $pid=1/ all
works fine, even with 60 second sleeps.
2) as we
On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote:
snip
It looks like it has something to do with $dbh going out of scope
(when the child exits).
snip
This is definitely a case of the database handle auto-disconnecting
when it is destroyed. You can see the behavior by creating a set of
DBI
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
It looks like it has something to do with $dbh going out of scope
(when the child exits).
snip
This is definitely a case of the database handle auto-disconnecting
when it is destroyed. You can see the behavior by creating a set
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
This is the reason really.I was also confused for this case once.
Thanks for Chas's explain.
snip
Knowing what is happening is only half the battle, now we need to find
a non-hacky solution.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
Sent: May 9, 2007 11:25 PM
To: Jeremy Kister [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: Re: forking problem with dbd::mysql
On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote:
snip
It looks like it has something to do with $dbh
();
}
}
Ok where in child when going out of scope the $dbh should get disconnected.
But why this would affect the $dbh in parent?As we know,when forking child get a
full copy of $dbh from parent and it's separate to parent's $dbh.
snip
But the connection information in the $dbh is the same, so when
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
Sent: May 10, 2007 12:02 AM
To: Jeff Pang [EMAIL PROTECTED]
Cc: beginners-list beginners@perl.org
Subject: Re: forking problem with dbd::mysql
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
But still has a question for me.We may
On 5/9/2007 11:12 AM, Chas Owens wrote:
my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1});
to
my $dbh = DBI-connect(
$dsn, $dbun, $dbpw,
{
RaiseError = 1,
mysql_auto_reconnect = 1
}
);
Yes, that works, just as a regular my $dbh = DBI-connect()
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
Yes but I think is this maybe a bug in DBI class?For example,open a file handle
and
after forking child close that handle,this would not affect parent's handle.
snip
It definitely violates the principle of least surprise, but it is also
-Original Message-
From: Jeremy Kister [EMAIL PROTECTED]
Sent: May 10, 2007 12:17 AM
To: beginners@perl.org
Subject: Re: forking problem with dbd::mysql
On 5/9/2007 11:12 AM, Chas Owens wrote:
my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1});
to
my $dbh = DBI-connect
On 5/9/07, Jeremy Kister [EMAIL PROTECTED] wrote:
On 5/9/2007 11:12 AM, Chas Owens wrote:
my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1});
to
my $dbh = DBI-connect(
$dsn, $dbun, $dbpw,
{
RaiseError = 1,
mysql_auto_reconnect = 1
}
);
Yes, that
On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote:
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
Yes but I think is this maybe a bug in DBI class?For example,open a file
handle and
after forking child close that handle,this would not affect parent's handle.
snip
It definitely violates
:
I'm am having an issue with a mysql connection that displays itself when
there's forking going on which I can't track down.
I've made a test program at http://jeremy.kister.net/code/ftest.pl to
demonstrate. I expect this program to print 'SQL RESULT: 1' for as long
as it can.
But instead
create the database connection after you fork().
On 5/9/2007, Chas Owens [EMAIL PROTECTED] wrote:
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
This is the reason really.I was also confused for this case once.
Thanks for Chas's explain.
snip
Knowing what is happening is only
[EMAIL PROTECTED] wrote:
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
Sent: May 10, 2007 12:02 AM
To: Jeff Pang [EMAIL PROTECTED]
Cc: beginners-list beginners@perl.org
Subject: Re: forking problem with dbd::mysql
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
On 5/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
This is an interesting point, but I think a database might be more
similar to a network socket than a file handle.
I have this same observed behaviour under Oracle and PostgreSQL, so it's
not limited to mysql (and shouldn't be fixed with
sing its handle unexpectedly.
The solution:
Setting a flag (InactiveDestroy) on the parent's handle inside the
child process prevents the automagic closing of the connection.
* the magic in this case is the DESTROY method of DBI::db
Where do you get the inactiveDestroy?
Is this something
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
And happily such a flag exists: InactiveDestroy.
Just add
$dbh-{InactiveDestroy} = 1;
to the child and the problem should go away.
I'm also happy to know it,this is good.
--
mailto:[EMAIL PROTECTED]
On 5/9/07, Tom Allison [EMAIL PROTECTED] wrote:
sing its handle unexpectedly.
The solution:
Setting a flag (InactiveDestroy) on the parent's handle inside the
child process prevents the automagic closing of the connection.
* the magic in this case is the DESTROY method of DBI::db
Where
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
Using InactiveDestroy flag seems a standard way since this module's author
provide this flag.
But it's maybe bring some problems when the applications are large enough,and
it's not
the fact that every programmer would disconnect their dbh
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
$dbh-{InactiveDestroy} = 1;
$dbh = DBI-connect($dsn, $dbun, $dbpw,
{RaiseError = 1});
# do stuff
yes this is the same with my meanings.Child re-open another dbh
On May 9, 2007, at 5:41 PM, Jeff Pang wrote:
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
The solution:
Setting a flag (InactiveDestroy) on the parent's handle inside the
child process prevents the automagic closing of the connection.
* the magic in this case is the
On 5/9/07, Tom Allison [EMAIL PROTECTED] wrote:
snip
In short -- you are lucky it can be supported.
But in order to keep things portable, this might be something to avoid?
In his case there is not a portability issue. What is not portable is
using the parent's handle inside the child, but he
-Original Message-
From: Chas Owens [EMAIL PROTECTED]
In his case there is not a portability issue. What is not portable is
using the parent's handle inside the child, but he is opening a new
handle inside the child. The problem was the auto-close behavior
which is made a non-problem by
I'm am having an issue with a mysql connection that displays itself when
there's forking going on which I can't track down.
I've made a test program at http://jeremy.kister.net/code/ftest.pl to
demonstrate. I expect this program to print 'SQL RESULT: 1' for as long
as it can.
But instead:
SQL
-Original Message-
From: Jeremy Kister [EMAIL PROTECTED]
Sent: May 9, 2007 11:05 AM
To: beginners@perl.org
Subject: forking problem with dbd::mysql
I'm am having an issue with a mysql connection that displays itself when
there's forking going on which I can't track down.
I've made
On 5/9/2007 12:01 AM, Jeff Pang wrote:
1) too less timeout setting in my.cnf? see /etc/my.cnf and look for this line:
I actually have no my.cnf. But if I s/my $pid = fork()/my $pid=1/ all
works fine, even with 60 second sleeps.
2) as we know,child exiting would return a SIGCHLD signal to
Hello all!
I've come to a point where I really need to start understanding
forking, threaded, select, and all that stuff. I created a test
script to play around with and it's doing what I'd expect, except for
one bit. My test script:
use strict;
use warnings;
print First Trial:\n\n
Jen Spinney wrote:
Hello all!
Hello,
print \nSecond Trial:\n\n;
if (open(CHILD, |-))
{
print parent starts: , (scalar localtime),\n;
print CHILD printing to child\n;
sleep 5;
print parent ends: , (scalar localtime),\n;
}
else
{
my $time = scalar localtime;
my
On 11/8/06, John W. Krahn [EMAIL PROTECTED] wrote:
Jen Spinney wrote:
Hello all!
Hello,
print \nSecond Trial:\n\n;
if (open(CHILD, |-))
{
print parent starts: , (scalar localtime),\n;
print CHILD printing to child\n;
sleep 5;
print parent ends: , (scalar localtime),\n;
}
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote:
use strict;
use warnings;
print First Trial:\n\n;
if (open(CHILD, |-))
{
print parent starts: , (scalar localtime),\n;
sleep 5;
print parent ends: , (scalar localtime),\n;
}
else
{
print child starts: , (scalar localtime),\n;
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote:
print CHILD printing to child\n;
sleep 5;
Concurrent processes can be counterintuitive at times. Because the
CHILD filehandle is buffered, that line won't necessarily be sent to
the child process right away. In your program, I'd expect
On 11/8/06, Jay Savage [EMAIL PROTECTED] wrote:
There are a couple of things going on here.
First, the issue of what prints when is driven by buffering. Since you
haven't turned on autofulsh on any of your file handles, the buffer is
flushed whenever it's convenient for the the system. The
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote:
Thanks Jay and Tom! I added this little bit to my script:
select (CHILD);
$| = 1;
select (STDOUT);
and it worked just as I expected it to. It's interesting, though,
that I've been working with sockets a bunch through IO::Socket and my
print
Thanks Jay and Tom! I added this little bit to my script:
select (CHILD);
$| = 1;
select (STDOUT);
and it worked just as I expected it to. It's interesting, though,
that I've been working with sockets a bunch through IO::Socket and my
print statements seem to print to the socket stream
Paul Johnson wrote:
On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote:
I've got a *bunch* of code that I've been rewriting recently and ran
into a rather weird problem.
it won't fork.
If I write the following:
foreach my $file ( @$files ) {
my $pid = fork();
print $pid --
-- file_two
but no 3243--file_two.
Repeated print statements later on in the job continue to indicate that
this is not forking correctly.
I've been changing a number of things over to objects and references,
but I can't see anyway that this would interfere with something so
fundamental.
Unfortunately
On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote:
I've got a *bunch* of code that I've been rewriting recently and ran
into a rather weird problem.
it won't fork.
If I write the following:
foreach my $file ( @$files ) {
my $pid = fork();
print $pid -- $file\n;
On 5/15/06, Tom Allison [EMAIL PROTECTED] wrote:
my $pid = fork();
print $pid -- $file\n;
Because your process table can become full and temporarily prevent
forking new processes, you should check the return value of fork
whenever you're making more than N processes. The value of N
-- file_two
but no 3243--file_two.
Repeated print statements later on in the job continue to indicate that
this is not forking correctly.
Try this:
use strict;
my @files = qw/aa bb cc/;
foreach my $file ( @files ) {
my $pid = fork();
print $pid -- $file\n;
exit 0 unless $pid;
}
and print
Hi all,
my $child = fork ();
unless ($child) {
sleep 5;
print child\n;
}
print parent\n if $child;
print parent2\n if $child;
the above code prints the parent lines followed by the child. Now what i
want to do is print the parent
line1 and then the child followed
On Tue, Mar 14, 2006 at 08:57:03AM +, Saurabh Singhvi wrote:
my $child = fork ();
unless ($child) {
sleep 5;
print child\n;
}
print parent\n if $child;
print parent2\n if $child;
the above code prints the parent lines followed by the child. Now
It's not so easy to do that.
you should use the signal to communicate between childs and parent.
-Original Message-
From: Saurabh Singhvi [EMAIL PROTECTED]
Sent: Mar 14, 2006 3:57 AM
To: Perl FAq beginners@perl.org
Subject: forking doubt
Hi all,
my $child = fork ();
unless
Thanks a lot for your replies, I've incorporated the children counter
variable, increasing it after every fork, decreasing it after every
SIG{CHLD}.
However, I still have an unresolved issue,
Jay:
It's not missing; it was never there. Your parent process dies before
its children are finished.
Does that not mean that a parent will stay alive until all children have
finished ?
No,the parent should get exited when it finish its session,in spite of childs
are still running or not.
When the parent exit,the childs should be take-overed by system init
process,whose process ID is
Thanks Jeff,
That clarifies it.
Regards
Cornelis
--memento mori
On 3/14/06, Jeff Pang [EMAIL PROTECTED] wrote:
Does that not mean that a parent will stay alive until all children have
finished ?
No,the parent should get exited when it finish its session,in spite of
childs are still
The process's pid is 1 really.It has been take-overed by system init
process.
Sorry for my mistake,it should be the process's ppid really.ppid just mean
'parent process id'.
--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
;
}
Tovid executes successfully for both files but when the encoding is finished
the parent process just hangs there.
The program is forking the children in parallel as can be seen from the
tovid output as well as tail -f log:
Simpsons episodes:
Simpsons_2
Simpsons_3
Forked child process
Cornelis Swanepoel wrote:
The SIG{CHLD} handler doesn't get called since the output from
print LOG Child process no. $stiff exited with status $?\n;
is missing.
It's not missing; it was never there. Your parent process dies before
its children are finished. It is no longer around to reap
On 3/13/06, Cornelis Swanepoel [EMAIL PROTECTED] wrote:
I have found the following text in the perlfork manpage:
Calling exec() within a pseudo-process actually spawns the requested
executable in a separate process and waits for it to complete before exiting
with the same exit status as
;
}
$SIG{CHLD} = \REAPER;
}
Tovid executes successfully for both files but when the encoding is finished
the parent process just hangs there.
The program is forking the children in parallel as can be seen from the tovid
output
as well as from tailing log
The SIG{CHLD
The SIG{CHLD} handler doesn't get called since the output from
print LOG Child process no. $stiff exited with status $?\n;
is missing.
You can't see the output in your log is because when your childs are
executing,your parent has exited.
In order to see the callbacking childs,just add this
Jeff Pang wrote:
You can't see the output in your log is because when your childs are
executing,your parent has exited.
In order to see the callbacking childs,just add this line in the code end:
sleep while(1); # parent sleep to wait for childs exiting
This would be a bad idea since the
This would be a bad idea since the process never exits.
En? I just want to show the childs exiting status.
Surely,you could modify it simply to get main process exit normally.
for example:
# you could get the childs numbers by counting the @files array
$CHILD_COUNT=N;
# defined the sig
* code 'paraphrased' for simplicity *
Hi all,
I have a script which goes to a subroutine. Within the subroutine, there
exists:
$pid = fork;
push(@pids, $pid);
unless ($pid)
{
my $var = new Object;
if (not $var-method_that_evokes_a_child()) {Exit;}
exit 2;
}
where the
steve abrams wrote:
* code 'paraphrased' for simplicity *
Hi all,
I have a script which goes to a subroutine. Within the
subroutine, there exists:
$pid = fork;
push(@pids, $pid);
unless ($pid)
{
my $var = new Object;
if (not $var-method_that_evokes_a_child())
closes. The natural thing to do for me was to preceed the call
of the forking function (namely parseurl) with
++$dbh-{InactiveDestroy}
and then add
undef $dbh-{InactiveDestroy}
as the first line of _dummy(). Worked like a charm since then.
Whether or not this works correctly on Windows I
I need some assistance.
I wrote a script that takes an array of IP addresses, and in a foreach
loop uses a subroutine to make a few SNMP connections, and writes
results to a flat file.(snipet below)
For 1000 IP addresses, it takes 17 minutes. I wonder if there's a way
to fork 10-20 (at a time)
I need some assistance.
I wrote a script that takes an array of IP addresses, and in a foreach
loop uses a subroutine to make a few SNMP connections, and writes
results to a flat file.(snipet below)
For 1000 IP addresses, it takes 17 minutes. I wonder if there's a way
to fork 10-20 (at
At 11:08 PM 3/8/04 -0500, Wiggins d'Anconia wrote:
This is where I do my usual little dance, though untimely as it may be
in this case, across the stage and say POE then exit again as if I was
still on vacation
OK, I'll bite. What's so great about POE, and why, oh, why, do you love it
so?
processes and maintain
bi-directional communication with them becomes a nightmare of dealing
with forking code, pipes, and all of the other IPC nasties.
POE::Wheel::Run encapsulates all of that providing a very simple
interface for dealing with forking those processes and handling their
input/output
At 08:54 AM 3/9/04 -0700, Wiggins d Anconia wrote:
In this case the desire to fork multiple processes and maintain
bi-directional communication with them becomes a nightmare of dealing
with forking code, pipes, and all of the other IPC nasties.
POE::Wheel::Run encapsulates all of that providing
At 08:54 AM 3/9/04 -0700, Wiggins d Anconia wrote:
In this case the desire to fork multiple processes and maintain
bi-directional communication with them becomes a nightmare of dealing
with forking code, pipes, and all of the other IPC nasties.
POE::Wheel::Run encapsulates all
At 09:52 AM 3/9/04 -0700, Wiggins d Anconia wrote:
...
a framework for handling time slicing, or event
programming tasks, or multi-tasking processes
If that's what it is, these terms localize it pretty well for me. An
event-based framework for handling time-slicing in multitasking processes.
--
At 09:52 AM 3/9/04 -0700, Wiggins d Anconia wrote:
...
a framework for handling time slicing, or event
programming tasks, or multi-tasking processes
If that's what it is, these terms localize it pretty well for me. An
event-based framework for handling time-slicing in multitasking
At 11:32 AM 3/9/04 -0700, Wiggins d Anconia wrote:
... famboozled watchamathingie with xanatically whooziewhatsit on a
beginners list ;-)...
Oh yeah, since you bring it up about the whooziewhatsit ...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
that I don't get booted off for channel
flooding.
POE is like forking, without the complete separation of data
and troublesome IPC issues.
POE is like threads, but with built-in data locking.
POE requires some discipline, but can be very powerful when used
correctly.
--
Randal L. Schwartz
Bob Showalter wrote:
Price, Jason wrote:
Hmm...I guess that's the majority of the script. :) I can follow
what it does, but I'm not entirely sure why it does it.
Also, is there any way I can self-contain the output from each child
process?
You can use a separate pipe for each child, but now
Not sure if this is the right list for this - if it's not, please direct me
to the proper list.
Anyway, I'm trying to get my hands around forking, and was hoping you all
could help me out. Basically, I'm trying to find a way to fire off a remote
script on numerous boxes in parallel, returning
Price, Jason wrote:
Not sure if this is the right list for this - if it's not, please
direct me to the proper list.
You've come to the right place.
Anyway, I'm trying to get my hands around forking, and was hoping you
all could help me out. Basically, I'm trying to find a way to fire
off
]
Sent: Wednesday, March 03, 2004 1:17 PM
To: 'Price, Jason'; '[EMAIL PROTECTED]'
Subject: RE: Forking
Price, Jason wrote:
Not sure if this is the right list for this - if it's not, please
direct me to the proper list.
You've come to the right place.
Anyway, I'm trying to get my hands
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 1:17 PM
To: 'Price, Jason'; '[EMAIL PROTECTED]'
Subject: RE: Forking
Price, Jason wrote:
Not sure if this is the right list for this - if it's not, please
direct me to the proper list.
You've
already exited (otherwise the loop wouldn't have exited.) You might want the
exit statuses or not. You can also usually use $SIG{CHLD} = 'IGNORE' prior
to the forking loop if you don't care about exit statuses. see perldoc
perlipc
Hmm...I guess that's the majority of the script. :) I can follow
statuses or not. You can also usually use $SIG{CHLD} = 'IGNORE'
prior to the forking loop if you don't care about exit statuses. see
perldoc perlipc
Uh, I appologize - anyway, could you explain that last part to me?
Do you create zombies if you dont handle the exit status of you child by
either
.) You
might want the exit statuses or not. You can also usually use
$SIG{CHLD} = 'IGNORE' prior to the forking loop if you don't care
about exit statuses. see perldoc perlipc
Uh, I appologize - anyway, could you explain that last part to me?
Do you create zombies if you dont handle the exit
I am learning about forks, so I tried the following code to make sure I
had everything down:
#! /usr/bin/perl
use strict;
use warnings;
my $counter = 1;
my $pid = 0;
while ($counter 50) {
if ($pid = fork) {
open (FORKED, ./fork/$counter)
or die(COULD NOT OPEN FORK);
print
Dan Anderson writes:
I am learning about forks, so I tried the following code to make sure I
had everything down:
#! /usr/bin/perl
use strict;
use warnings;
my $counter = 1;
my $pid = 0;
while ($counter 50) {
if ($pid = fork) {
open (FORKED, ./fork/$counter)
On Dec 10, 2003, at 3:52 PM, Dan Anderson wrote:
I am learning about forks, so I tried the following code to make sure I
had everything down:
Still don't believe me about Network Programming with Perl, eh? Did I
mention that it covers forking well? laughs
Basic idea of fork:
if ($pid = fork
that it covers forking well? laughs
LOL. Thanks for all your help. I actually put a copy on my Safari
bookshelf but I have yet to start it.
-Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
(COULD NOT OPEN FORK);
print FORKED $counter;
close(FORKED);
$SIG{CHLD} = IGNORE;
}
$counter++;
}
[snip]
So what am I doing wrong?
you are forking a lot more child than you think! what you essentially have
is:
start with 1 process, fork:
parent process
1 - 100 of 138 matches
Mail list logo