I would like to run several receivers that will receive data in different ports, but are basically the same. What is more suitable in performance aspect - Multithreading开发者_JAVA技巧 or Multiprocessing?
The trouble with Python is that the most common interpreters contain a global lock -- commonly known as the GIL. This means that only one thread can execute python code at once, so a multi-process model can often make more efficient use of multiple cores than a multi-thread model.
If the application is I/O-bound, threading will suffice (and be faster).
If it's CPU-bound, and you're using cpython or another Python interpreter with a GIL, multiprocessing is the right choice instead.
精彩评论