Multi-Processing

Introduction

Multi-processing is the utilization of two or more central processing units (CPUs) in a single computer. In general it refers to the ability to support multiple CPUs and distribute work among them.

Multi-processing on a computer with one core can give the appearance multi-processing. It does this by giving each process a small slice of CPU time. Thus sharing the CPU with many processes.

For an excellent explanation/description of multiprocessing click HERE .

FYI: My notes from the video "Threading vs Multiprocessing in Python". Click HERE

Project #0

How many CPUs (cores) does your computer have?

import multiprocessing print(f'Number of cpu : {multiprocessing.cpu_count()}')

Project #1

The instructor will give you the requirements/design, or find a problem on the web (there are many of them). Code it and test/demonstrate mutithreading vs multiprocessing.

import time def test() -> float: start_t = time.perf_counter() # ---- perform some activity time.sleep(0.1) end_t = time.perf_counter() return end_t - start_t elapsed_time = test() print(f'test took {elapsed_time} sec')

Links

Multithreading vs Multiprocessing – Difference Between Them

Multiprocessing — Process-based parallelism

A Guide to Python Multiprocessing and Parallel Programming

Python Multiprocessing Example

Unlocking your CPU cores in Python (multiprocessing)

What is ETL (Extract Transform Load)?

Using Python for ETL: Tools, Scripts, Methods & Framework

9 Best Python ETL Tools in 2024

4 Ways to Time Python Functions

Threading vs Multiprocessing in python (YouTube)