For example, certain calculations could profit from it if one distributes them on several CPUs. What else do you have the expensive gizmos for? Here is a simple, admittedly somewhat pointless example:
#!/usr/bin/env perl use strict; use warnings; use Math::BigInt; use Parallel::ForkManager; use Time::HiRes qw ( time ); use feature qw(say); my $sleep_period = shift; my $processes = qx(sysctl -n hw.ncpu); chomp $processes; my $pm = Parallel::ForkManager->new($processes); $pm->set_waitpid_blocking_sleep($sleep_period); say qq(processes: $processes); my $start = time; for my $number ( 1 .. 50 ) { $pm->start($number) and next; my $factorial = Math::BigInt->bfac(2000) for 1 ... 10; $pm->finish(0); } $pm->wait_all_children; say qq(fork: ), time - $start;
See also this eight-year-old thread from which the example comes.
«The Crux of the Biscuit is the Apostrophe»
In reply to Re^2: Parallel Processing on win10
by karlgoethebier
in thread Parallel Processing on win10
by BernieC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |