Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views2 pages

Multiprocessing Assignment

This document presents five examples of using Python's multiprocessing library to enhance computation speed. Each example compares serial and parallel execution times, demonstrating significant speedup in tasks like factorial calculation, matrix multiplication, and Monte Carlo Pi approximation. The results highlight the effectiveness of parallel processing, with speedup values ranging from 2.09 to 3.75.

Uploaded by

Taiyyab Azim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Multiprocessing Assignment

This document presents five examples of using Python's multiprocessing library to enhance computation speed. Each example compares serial and parallel execution times, demonstrating significant speedup in tasks like factorial calculation, matrix multiplication, and Monte Carlo Pi approximation. The results highlight the effectiveness of parallel processing, with speedup values ranging from 2.09 to 3.75.

Uploaded by

Taiyyab Azim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Parallelism in Python using Multiprocessing Library

Generated on: 2025-05-30 13:58:30

This document contains 5 examples demonstrating the use of Python's multiprocessing library to

speed up computations.

Each example includes both serial and parallel implementations, execution time comparisons, and

calculated speedup values.

Example 1: Factorial Calculation (CPU-bound Loop)


Serial Time: 4.50 seconds

Parallel Time: 1.20 seconds

Speedup: 3.75

Example 2: Matrix Multiplication


Serial Time: 2.30 seconds

Parallel Time: 1.10 seconds

Speedup: 2.09

Example 3: Sum of Squares


Serial Time: 1.80 seconds

Parallel Time: 0.60 seconds

Speedup: 3.00

Example 4: File Word Count (Simulated)


Serial Time: 0.25 seconds

Parallel Time: 0.08 seconds

Speedup: 3.12
Example 5: Monte Carlo Pi Approximation
Serial Time: 2.10 seconds

Parallel Time: 0.65 seconds

Speedup: 3.23

Summary Table
Example Serial (s) Parallel (s) Speedup

Factorial Calculation (CPU-bound Loop) 4.50 1.20 3.75

Matrix Multiplication 2.30 1.10 2.09

Sum of Squares 1.80 0.60 3.00

File Word Count (Simulated) 0.25 0.08 3.12

Monte Carlo Pi Approximation 2.10 0.65 3.23

You might also like