… | |
… | |
27 | |
27 | |
28 | Special care has been taken to make this module useful from other modules, |
28 | Special care has been taken to make this module useful from other modules, |
29 | while still supporting specialised environments such as L<App::Staticperl> |
29 | while still supporting specialised environments such as L<App::Staticperl> |
30 | or L<PAR::Packer>. |
30 | or L<PAR::Packer>. |
31 | |
31 | |
32 | =head1 WHAT THIS MODULE IS NOT |
32 | =head2 WHAT THIS MODULE IS NOT |
33 | |
33 | |
34 | This module only creates processes and lets you pass file handles and |
34 | This module only creates processes and lets you pass file handles and |
35 | strings to it, and run perl code. It does not implement any kind of RPC - |
35 | strings to it, and run perl code. It does not implement any kind of RPC - |
36 | there is no back channel from the process back to you, and there is no RPC |
36 | there is no back channel from the process back to you, and there is no RPC |
37 | or message passing going on. |
37 | or message passing going on. |
… | |
… | |
40 | in whatever way you like, use some message-passing module such |
40 | in whatever way you like, use some message-passing module such |
41 | as L<AnyEvent::MP>, some pipe such as L<AnyEvent::ZeroMQ>, use |
41 | as L<AnyEvent::MP>, some pipe such as L<AnyEvent::ZeroMQ>, use |
42 | L<AnyEvent::Handle> on both sides to send e.g. JSON or Storable messages, |
42 | L<AnyEvent::Handle> on both sides to send e.g. JSON or Storable messages, |
43 | and so on. |
43 | and so on. |
44 | |
44 | |
|
|
45 | =head2 COMPARISON TO OTHER MODULES |
|
|
46 | |
|
|
47 | There is an abundance of modules on CPAN that do "something fork", such as |
|
|
48 | L<Parallel::ForkManager>, L<AnyEvent::ForkManager>, L<AnyEvent::Worker> |
|
|
49 | or L<AnyEvent::Subprocess>. There are modules that implement their own |
|
|
50 | process management, such as L<AnyEvent::DBI>. |
|
|
51 | |
|
|
52 | The problems that all these modules try to solve are real, however, none |
|
|
53 | of them (from what I have seen) tackle the very real problems of unwanted |
|
|
54 | memory sharing, efficiency, not being able to use event processing or |
|
|
55 | similar modules in the processes they create. |
|
|
56 | |
|
|
57 | This module doesn't try to replace any of them - instead it tries to solve |
|
|
58 | the problem of creating processes with a minimum of fuss and overhead (and |
|
|
59 | also luxury). Ideally, most of these would use AnyEvent::Fork internally, |
|
|
60 | except they were written before AnyEvent:Fork was available, so obviously |
|
|
61 | had to roll their own. |
|
|
62 | |
45 | =head1 PROBLEM STATEMENT |
63 | =head2 PROBLEM STATEMENT |
46 | |
64 | |
47 | There are two traditional ways to implement parallel processing on UNIX |
65 | There are two traditional ways to implement parallel processing on UNIX |
48 | like operating systems - fork and process, and fork+exec and process. They |
66 | like operating systems - fork and process, and fork+exec and process. They |
49 | have different advantages and disadvantages that I describe below, |
67 | have different advantages and disadvantages that I describe below, |
50 | together with how this module tries to mitigate the disadvantages. |
68 | together with how this module tries to mitigate the disadvantages. |