This repository contains Python code to perform matrix multiplication using multithreading. The program explores the performance impact of utilizing multiple threads on CPU-bound tasks such as matrix multiplication.
Matrix multiplication is a computationally intensive task, particularly for large matrices. By leveraging multithreading, it's possible to distribute the workload across multiple CPU cores, potentially speeding up the computation.
- Multithreading: Utilizes Python's threading module to perform matrix multiplication concurrently on multiple threads.
- Performance Analysis: Measures and compares the execution time for different numbers of threads.
- Visualization: Includes a graphical representation of execution time versus the number of threads using matplotlib.
The program will output the execution time for different numbers of threads, demonstrating the impact of multithreading on performance.
Additionally, a graphical representation of execution time versus the number of threads will be displayed.
The CPU usage illustrates the system's resource utilization during the execution of the program, providing insights into the efficiency of multithreading and the distribution of computational workload across CPU cores.
With four CPU cores available, the execution time decreased as the number of threads increased up to four. However, as we continued to increase the number of threads beyond the available cores, from five to eight, the execution time also increased slightly. This suggests that while utilizing up to the number of available CPU cores can significantly improve performance, exceeding that number can lead to diminishing returns and even slight performance degradation due to increased overhead.