Results 1 to 2 of 2
I'm wondering how python's thread & fork support is compared to perl? Which one is best option among Perl and Python...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 03-24-2011 #1
- Join Date
- Oct 2009
python vs perl for threads/forking
- 03-29-2011 #2
- Join Date
- Nov 2008
- Tokyo, Japan
The "fork()" function is actually a system-call, so any programming languages which can execute the "fork()" function will all be calling the exact same system-level function in the end. Performance is determined by execution of byte-code in the runtime, not by "fork()".
As for threads, most runtime environments that execute bytecode, like the runtime for Perl, Python, or Java, all have their own internal threading mechanisms which are fine-tuned to work with their garbage collectors, and tested to avoid deadlocks, race conditions, and other security problems. It's hard to say which is "better", they both need to provide the same functionality. As for performance, skillful programming is much more important than the internal threading implementation.
With a cursory Google search you can find multithreading libraries for both Perl and Python which are recommended for use with their respective programming system. It is either not possible, or not recommended, to use bindings to an external library like pthreads.
If it were me, however, and multiple threads and performance were an issue, I try to avoid using high-level languages like Perl or Python to get the job done.