threading

Marko Rauhamaa marko at pacujo.net
Mon Apr 7 01:10:49 EDT 2014


Ben Finney <ben+python at benfinney.id.au>:

> The *whole point* of threading (AFAIK) is to share memory and other
> process-distinct resources.

Another way to look at it is that threads were pushed as a magic bullet
to manage the complexities of network programming. They were fashionable
in Windows and Java. The idea was that the programmer could write linear
code that blocks on I/O and not be overwhelmed by the intricacies.

I don't think it worked out all that well.

Since then both Windows and Java have come up with their own I/O
multiplexing facilities. Now we see Python follow suit with asyncio.

Threads have their uses, but they are such tricky beasts that I would
see first if the problem couldn't be handled with multiplexing and
multiprocessing.

The main need for threads today comes from the database libraries,
which, AFAIK, generally don't provide a nonblocking API.


Marko



More information about the Python-list mailing list