[25963] in Perl-Users-Digest
Perl-Users Digest, Issue: 8182 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 17 18:05:27 2005
Date: Fri, 17 Jun 2005 15:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Jun 2005 Volume: 10 Number: 8182
Today's topics:
Algorithm: spreading out jobs/events in time <pkent77tea@yahoo.com.tea>
Re: How to kill a forked child process... <moritz.karbach@desy.de>
Re: How to kill a forked child process... <moritz.karbach@desy.de>
Re: How to kill a forked child process... <moritz.karbach@desy.de>
Re: How to kill a forked child process... <moritz.karbach@desy.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Jun 2005 22:46:27 +0100
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Algorithm: spreading out jobs/events in time
Message-Id: <pkent77tea-362F77.22462217062005@ptn-nntp-reader02.plus.net>
hi,
I'm sure someone must have solved this problem before, but I've
exhausted my searches of CPAN and the web - I bet there's a name for
this algorithm but I don't know what.
Imagine I have a program which has a number of independent, equally hard
(i.e. same CPU usage) jobs to do. Each job should be run every 5
minutes. What I want to do is spread those jobs out so that the "work"
is as evenly distributed as possible.
In that case it's obvious that I need to stagger each job by 5/n minutes
to spread them out most evenly. Easy.
But this is the hard part... what if some of my jobs have _different_
frequencies? I want to work out how to stagger each job so that, over
time, the work is still spread out on average and I minimize the number
of times when jobs occur together.
Visual example:
E.g. imagine 2 jobs that run every 4 minutes, and one that runs every 8.
One way of spreading them out would be this (each number is a different
job:
1...1...1...1...1...1...1...1...
..2...2...2...2...2...2...2...2.
...3.......3.......3.......3...
as opposed to
1...1...1...1...1...
2...2...2...2...2...
3.......3.......3...
I've been thinking about frequencies, harmonics, phases, highest common
factors, subsets of jobs with the highest common factor, differentials,
local minima, ... but is this soluble?
any help appreciated
P
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Fri, 17 Jun 2005 19:13:25 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: How to kill a forked child process...
Message-Id: <d8v0f2$4tghl$1@claire.desy.de>
> The parent process of the child (not the sibling) must wait() or ignore
> $SIG{CHLD}.
Thanks for the hint. I moved the
$SIG{CHLD} = "IGNORE";
$SIG{CLD} = "IGNORE";
to the parent and the zombies disappeared.
> This doesn't really have anything to do with Perl, this is a Unix
> question.
I'm sorry. Since both Perl and Unix signal handling are relatively new to
me, it's hard for me to distinguish.
Cheers,
- Moritz
------------------------------
Date: Fri, 17 Jun 2005 19:13:25 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: How to kill a forked child process...
Message-Id: <d8v0e1$4tsju$1@claire.desy.de>
> The parent process of the child (not the sibling) must wait() or ignore
> $SIG{CHLD}.
Thanks for the hint. I moved the
$SIG{CHLD} = "IGNORE";
$SIG{CLD} = "IGNORE";
to the parent and the zombies disappeared.
> This doesn't really have anything to do with Perl, this is a Unix
> question.
I'm sorry. Since both Perl and Unix signal handling are relatively new to
me, it's hard for me to distinguish.
Cheers,
- Moritz
------------------------------
Date: Fri, 17 Jun 2005 19:13:25 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: How to kill a forked child process...
Message-Id: <d8v0bn$4t4be$1@claire.desy.de>
> The parent process of the child (not the sibling) must wait() or ignore
> $SIG{CHLD}.
Thanks for the hint. I moved the
$SIG{CHLD} = "IGNORE";
$SIG{CLD} = "IGNORE";
to the parent and the zombies disappeared.
> This doesn't really have anything to do with Perl, this is a Unix
> question.
I'm sorry. Since both Perl and Unix signal handling are relatively new to
me, it's hard for me to distinguish.
Cheers,
- Moritz
------------------------------
Date: Fri, 17 Jun 2005 19:13:25 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Re: How to kill a forked child process...
Message-Id: <d8v0j7$4taod$1@claire.desy.de>
> The parent process of the child (not the sibling) must wait() or ignore
> $SIG{CHLD}.
Thanks for the hint. I moved the
$SIG{CHLD} = "IGNORE";
$SIG{CLD} = "IGNORE";
to the parent and the zombies disappeared.
> This doesn't really have anything to do with Perl, this is a Unix
> question.
I'm sorry. Since both Perl and Unix signal handling are relatively new to
me, it's hard for me to distinguish.
Cheers,
- Moritz
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8182
***************************************