diff --git a/multithreading-multiprocessing.html b/multithreading-multiprocessing.html index 2f383d6..0f43c92 100644 --- a/multithreading-multiprocessing.html +++ b/multithreading-multiprocessing.html @@ -184,6 +184,50 @@
Aspect | +Multithreading | +Multiprocessing | +
---|---|---|
Memory Usage | +Less memory usage/Shared memory space | +More memory usage/Separate memory space for each process | +
Concurrency Type | +Concurrent threads within a single process | +Parallel processes with separate memory spaces | +
GIL Impact | +Affected by GIL (only one thread executes Python code at a time) | +No GIL; multiple processes can run Python code simultaneously | +
Best For | +I/O-bound tasks (e.g., web scraping, file I/O) | +CPU-bound tasks (e.g., heavy computations) | +
Synchronization | +More complex due to shared state | +Less complex but requires IPC for communication | +
Overhead | +Lower overhead, but limited by GIL | +Higher overhead due to process creation and management, but no GIL limitation | +
Fault Isolation | +A thread crash can affect the entire process | +A process crash is isolated to that process | +