threading
Paul Rubin
no.email at nospam.invalid
Mon Apr 7 01:39:05 EDT 2014
Marko Rauhamaa <marko at pacujo.net> writes:
> Since then both Windows and Java have come up with their own I/O
> multiplexing facilities. Now we see Python follow suit with asyncio.
That all happened because threads in those systems are rather expensive.
GHC and Erlang have fast lightweight threads/processes and programming
with them is much more civilized than using async schemes. Even a low
level language like Forth reached something similar.
I keep hearing about all the perils of threading bugs and it just hasn't
happened to me in Python as far as I know. The main trick is to not
share any mutable data between threads. Instead have them communicate
by message passing through Queues. If you've got a lot of tasks in the
system then it helps to have a bit of abstraction to keep the queues
organized and make the other tasks addressible by name, but it's all
pretty straightforward. You do take an efficiency hit, but if that's a
big concern you sort of have to look past Python.
Lately I'm messing with Go and it's sort of the same idea.
More information about the Python-list
mailing list