CSC352 Comparison threading to multiprocessing

From dftwiki3
Revision as of 09:22, 11 February 2010 by Thiebaut (talk | contribs) (Experiment)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.