Concurrency

Bryan Lott published on
1 min, 185 words

Or... why Python will eventually become irrelevant.

The GIL (Global Interpreter Lock) is something that haunts me every time I go to multithread something in Python. The hazard that comes with running pool.map(function, list) if the list has unpickleable items in it is another roadblock in front of multiprocessing.

Moore's law is only being kept by increasing the number of cores on each processor and if Python doesn't figure out how to easily multithread/multiprocess eventually it's going to fall behind in the race for speed.

Of course, this leads me to my favorite new programming language, Clojure. The ease of multithreading is incredible:

;; singlethreaded
(map function list)
;; multithreaded
(pmap function list)

Programming in a multithreaded way is incredibly easy because you're already coding in a functional style which lends itself very easily to being multithreaded. Reasoning about code is so much simpler and as incidental complexity increases, I think languages like Clojure that are functional and multithreaded will only gain mindshare. They're easier to reason about as problem complexity increases without increasing incidental complexity significantly while maintaining a sustainable speed.