When to use and when not to use multi-threading and multi-processing? Which is better and when?
Multi-threading shares the same memory address, the communication between them is very efficient. While multi-processing do not share the memory space, the communication is complex with socket.
The creating and destroying thread is much cheaper than creating and destroying the process
Process context switching is more expensive than the thread context switching.
When you want to run some applications which will share some resources or communicate with each other, we can use multithreading
When you want to run some independent applications, we can use multiprocessing
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment