Difference between revisions of "CSC352 Comparison threading to multiprocessing"
(→Experiment) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <bluebox> | ||
+ | This is a simple comparison of the execution times of the N-Queen program in a threaded version, and in a multiprocessing version. This application is ideally parallel in that there is no communication required between threads or processes, except at the end when a solution has been found. The program stops when the first solution is found. | ||
+ | </bluebox> | ||
+ | |||
+ | <br /> | ||
+ | __TOC__ | ||
+ | |||
+ | ===Experiment=== | ||
+ | |||
+ | * Ran Threaded and Multiprocessing versions of NQueens programs (see [[:Category:Python]] for source code) for N ranging from 10 to 25. | ||
+ | |||
+ | * Typical shell script: | ||
+ | <br /> | ||
+ | <source lang="bash"> | ||
+ | #! /bin/bash | ||
+ | # multiprocessingNQueens.py | ||
+ | |||
+ | for i in {10..25} | ||
+ | do | ||
+ | echo $i | ||
+ | time python ./mulitprocessingNQueens.py $i | grep user | ||
+ | done | ||
+ | </source> | ||
+ | <br /> | ||
+ | |||
+ | * recorded the times in spreadsheet (used [[CSC352ParseExecutionTimes.py | Python program]] to parse the data) | ||
+ | |||
<center> | <center> | ||
[[Image:CSC352ComparisonMultiprocessingThreadingNQueens.png]] | [[Image:CSC352ComparisonMultiprocessingThreadingNQueens.png]] | ||
Line 4: | Line 31: | ||
* [[Media:CSC352ComparisonMultiProcThreaded.xls.gz | spreadsheet]] | * [[Media:CSC352ComparisonMultiProcThreaded.xls.gz | spreadsheet]] | ||
+ | |||
+ | ===Another Comparison=== | ||
+ | |||
+ | [http://www.python.org/dev/peps/pep-0371/ PEP 371] provides a nice collection of benchmarks comparing the execution times of threaded applications versus their multiprocessing equivalent. | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC352]][[Category:Threads]][[Category:Multiprocessing]] |
Latest revision as of 09:22, 11 February 2010
This is a simple comparison of the execution times of the N-Queen program in a threaded version, and in a multiprocessing version. This application is ideally parallel in that there is no communication required between threads or processes, except at the end when a solution has been found. The program stops when the first solution is found.
Contents
Experiment
- Ran Threaded and Multiprocessing versions of NQueens programs (see Category:Python for source code) for N ranging from 10 to 25.
- Typical shell script:
#! /bin/bash
# multiprocessingNQueens.py
for i in {10..25}
do
echo $i
time python ./mulitprocessingNQueens.py $i | grep user
done
- recorded the times in spreadsheet (used Python program to parse the data)
Another Comparison
PEP 371 provides a nice collection of benchmarks comparing the execution times of threaded applications versus their multiprocessing equivalent.