Parallel-MPM-Prefork
view release on metacpan or search on metacpan
lib/Parallel/MPM/Prefork.pm view on Meta::CPAN
=head2 You Don't Mess with the ZIGCHLD
Parallel::MPM::Prefork relies on SIGCHLD being delivered to its own handler in
the main process (installed by pf_init()) and select() being interrupted by at
least SIGCHLD.
=head2 Forking your own processes
Parallel::MPM::Prefork creates a process group with setpgrp() which allows it
to wait only for its own child processes. That is, if you want to fork and
wait for an independent child process you just call setpgrp() in the child and
waitpid($pid, ...) in the main process.
system(LIST) can be replaced by system('setsid', LIST);
However, Parallel::MPM::Prefork will still catch SIGCHLD (see previous note).
=head2 Difference to Parallel::ForkManager
With Parallel::ForkManager, the main process decides in advance how much work
there is to do, how to split it up and how many child processes will work in
parallel. A child is always considered busy.
With Parallel::MPM::Prefork, the child processes take on work automatically as
it arrives. A child may be busy or idle. The main process only makes sure
there are always enough child processes available without too many idling
around.
Keep in mind that these are completely different use cases.
=head1 SEE ALSO
=head2 Net::Server::Prefork
Similar to Parallel::MPM::Prefork but limited to serving network
connections. Heavyweight hook-laden OO style. A pain in the ass when it comes
to customizing signal handling but its pipe concept for managing child
processes rocks. Inspired the creation of this module.
=head2 Parallel::ForkManager
Different use case (see NOTES). Waits for all child processes, not only its
own offspring; we don't (see NOTES). Features the awesome inline child code
paradigm.
=head2 Parallel::Prefork::SpareWorkers
Kind of a hybrid between Net::Server::Prefork and Parallel::ForkManager. Fails
to manage the workers if you want to keep them alive.
=head1 ACKNOWLEDGEMENTS
Thanks to the UN for not condemning child labor on the operating system level.
=head1 COPYRIGHT
Copyright © 2013 Carsten Gaebler (cgpan ÊÉ gmx Êop de). All rights reserved.
I only accept encrypted e-mails, either via
L<SMIME|http://cpan.org/authors/id/C/CG/CGPAN/cgpan-smime.crt> or
L<GPG|http://cpan.org/authors/id/C/CG/CGPAN/cgpan-gpg.asc>.
=head1 LICENSE
This program is free software. You can redistribute and/or modify it under the
same terms as Perl itself.
=cut
( run in 0.577 second using v1.01-cache-2.11-cpan-df04353d9ac )