Difference between revisions of "CSC352 Comparison threading to multiprocessing"

From dftwiki3
Jump to: navigation, search
(Experiment)
 
(2 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===
 
===Experiment===
  
Line 4: Line 11:
  
 
* Typical shell script:
 
* Typical shell script:
<source lang="sh">
+
<br />
 +
<source lang="bash">
 
#! /bin/bash
 
#! /bin/bash
 
# multiprocessingNQueens.py
 
# multiprocessingNQueens.py
Line 14: Line 22:
 
done
 
done
 
</source>
 
</source>
 +
<br />
  
 
* recorded the times in spreadsheet (used [[CSC352ParseExecutionTimes.py | Python program]] to parse the data)
 
* recorded the times in spreadsheet (used [[CSC352ParseExecutionTimes.py | Python program]] to parse the data)
Line 22: 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.


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


CSC352ComparisonMultiprocessingThreadingNQueens.png

Another Comparison

PEP 371 provides a nice collection of benchmarks comparing the execution times of threaded applications versus their multiprocessing equivalent.