Re: Algorithm: spreading out jobs/events in time
- From: kevindotcar@xxxxxxxxx
- Date: 21 Jun 2005 11:59:28 -0700
pkent wrote:
> hi,
>
[---]
> 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...
>
[---]
Hi pkent,
You could fire them all off, and have a semaphore for each task- kindof
like this;
use Win32::Semaphore;
.....
Win32::Semaphore::Create($Sem,1,1,"Task1Sem")||die &Error;
if($Sem) {
$Sem->wait();
##semaphore is now UP....
### do all Task1 work
...
##place semaphore flag down...
$Sem->Release(1,$last);
}
else {
die("ERROR Getting SEMAPHORE");
}
...Programmers typically use these for database operations, but it
should be applicable to your needs. You of course have to figure out
what the work-thresholds are for your needs; You might need to "hold"
on several semaphore-flags... in which case beware of deadlocks.
Do a perldoc on Win32::Semaphore for specs- Perl also has semaphores
for UNIX/Linux if that's your need, but I don't know what they're
called.
HTH-
kDot
.
- References:
- Algorithm: spreading out jobs/events in time
- From: pkent
- Algorithm: spreading out jobs/events in time
- Prev by Date: Re: Algorithm: spreading out jobs/events in time
- Next by Date: Re: Net::Telnet and SMTP
- Previous by thread: Re: Algorithm: spreading out jobs/events in time
- Next by thread: FAQ 3.4 How do I find which modules are installed on my system?
- Index(es):