Sunday, August 26, 2012

Perl thread vs fork

After an extensive research on parallel processing with Perl I came to the conclusion when to use threads and when to use forks.

1. If you have a set of repetitive tasks, use forks.
2. If you require lots of communication between processes, use threads.

Remember that threads are heavier than forks but on the other hand forks are too complex to handle inter-process communication. Sometimes you may just need to share parent variables to children and if that's enough, than go for forks.
Post a Comment