Using the threading module, generate 4 threads to concurrently count the prime numbers of the list with
Fantastic news! We've Found the answer you've been seeking!
Question:
- Using the threading module, generate 4 threads to concurrently count the prime numbers of the list with each thread processing one quarter of the numbers (i.e., the 1st thread processes n[0] to n[9999], the 2nd thread processes n[10000] to n[19999], etc.); Also, using the time module and insert code to measure the running time of the threads, e.g., from start() to join().
- Using the concurrent.futures module, generate 4 threads to do the same and measure the program running time as above.
- Bonus: using the numpy module to define the array of the same size, count the number of prime numbers, and measure the running time.
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date: