Difference between revisions of "CSC352 Homework 2"

From dftwiki3
Jump to: navigation, search
(Created page with '<bluebox> This assignment is due on 2/18/10. </bluebox> <br> <br> __TOC__ <br> ==Problem #1== Take the multiprocessing version of the N-Queens program and fix it. It is current…')
 
(Problem #1)
Line 10: Line 10:
 
Take the multiprocessing version of the N-Queens program and fix it.  It is currently inefficient, as we saw in class.  In particular, it does not need the ''foundOne'' boolean, and it has to wait for all the child processes to finish before it can finish executing.  Instead, change the code so that all the processes are "told" to stop when one solution is found.  This way the parent process will not have to wait around.
 
Take the multiprocessing version of the N-Queens program and fix it.  It is currently inefficient, as we saw in class.  In particular, it does not need the ''foundOne'' boolean, and it has to wait for all the child processes to finish before it can finish executing.  Instead, change the code so that all the processes are "told" to stop when one solution is found.  This way the parent process will not have to wait around.
  
Once your program works, measure its "best of four runs" execution time and plot it for N=10 to 25.  In other words, run it 4 times for N=10, and keep the best time.  4 times for N=11 and keep the best time, etc.
+
Once your program works, measure its ''best of four''  execution times and plot it for N=10 to 25.  In other words, run it 4 times for N=10, and keep the best time.  4 times for N=11 and keep the best time, etc. Plot the best times obtained. 
  
 
You may find the following [[CSC352 Scripts to Measure Execution Times | page]] useful for generating the list of best times.
 
You may find the following [[CSC352 Scripts to Measure Execution Times | page]] useful for generating the list of best times.
 +
 +
Compare these execution times to those you obtained for your improved threaded versions.
 +
 +
Put the listing and your comments in a pdf and submit it in your CSC352 account as follows:
 +
 +
    submit hw2 hw2a.pdf

Revision as of 18:26, 11 February 2010

This assignment is due on 2/18/10.



Contents


Problem #1

Take the multiprocessing version of the N-Queens program and fix it. It is currently inefficient, as we saw in class. In particular, it does not need the foundOne boolean, and it has to wait for all the child processes to finish before it can finish executing. Instead, change the code so that all the processes are "told" to stop when one solution is found. This way the parent process will not have to wait around.

Once your program works, measure its best of four execution times and plot it for N=10 to 25. In other words, run it 4 times for N=10, and keep the best time. 4 times for N=11 and keep the best time, etc. Plot the best times obtained.

You may find the following page useful for generating the list of best times.

Compare these execution times to those you obtained for your improved threaded versions.

Put the listing and your comments in a pdf and submit it in your CSC352 account as follows:

   submit hw2 hw2a.pdf