0

I see this when I read the book Foundations of Python Network Programming,

Note that running threads under standard C Python will impose on your server the usual limitation that no more than one thread can be running Python code at any given time.

Dose it means threads can't be running at the same time? If so, what is the advantage of implementing multi-threads?

flymike
  • 357
  • 1
  • 2
  • 5
  • Apparently, you have to use multiprocessing rather than multithreading to achieve proper parallelism. See, e.g., the `multiprocessing` module/package – hlt Aug 11 '14 at 07:00
  • 1
    You can have more than one thread running at a time, but only one of them can be running Python code. If your threads are IO-bound (usually waiting on a network, disk, user, etc.), that's not a problem. If your threads are running non-Python code, like a C extension specifically designed for that purpose (e.g., NumPy), they can run in parallel. Finally, if you're using threads for simplicity rather than multicore scalability, there's no problem. – abarnert Aug 11 '14 at 07:03

0 Answers0