Free threads is basically multithreading. Threads are relatively lightweight compared to processes because they (threads) share the same memory as the parent process. Communication between threads is also simpler, you can directly write to memory. Whereas communication across processes is expensive because it requires serialization and deserialization. The only advantage of multiprocessing was that those processes could run in parallel. But now you can run threads in parallel as well.
Multiple interpreters gives you similar flexibility as multiprocessing. You can create multiple interpreters and execute code in them in parallel. These are also relatively lightweight than multiprocessing. In fact these are less expensive than creating threads also. However, there maybe some overhead of serialization when sharing data across interpreters using the queue.
Thanks for your overview, two questions:
1. What is the advantage of free threads over multiprocessing?
2. What are the practical applications of multiple interpreters?
Hi Yury,
Free threads is basically multithreading. Threads are relatively lightweight compared to processes because they (threads) share the same memory as the parent process. Communication between threads is also simpler, you can directly write to memory. Whereas communication across processes is expensive because it requires serialization and deserialization. The only advantage of multiprocessing was that those processes could run in parallel. But now you can run threads in parallel as well.
Multiple interpreters gives you similar flexibility as multiprocessing. You can create multiple interpreters and execute code in them in parallel. These are also relatively lightweight than multiprocessing. In fact these are less expensive than creating threads also. However, there maybe some overhead of serialization when sharing data across interpreters using the queue.