Some problems don't care. Some do. But for those where threading is a more appropriate solution, the Python GIL is a significant limitation. And this is a great exposition as to why.
Announcing that threading should never be used just tells the world that you only work in one problem domain (probably web content generation) and haven't thought through the details elsewhere.
I've had much more luck using Python Remote Objects: http://pyro.sourceforge.net/
It's trivial to make a network queue and use that for communication across different processes/machines/etc.
Lots of devs come from the java world or windows world where threads are done all the time but multiprocess concurrency is rare.
I'd say that out of the projects I've seen people grab for threads, only about 10-15% actually need the type of heavily shared data or marginally smaller memory footprint that threading gives you. Of the rest of them, it was a toss up, or leaned towards the simplification of data structures, easier porting to multiple processors and overall less complex components that IPC gives you.
Additionally, I'd contend you're doing something wrong if you see a HUGE increase when you go from threads-> multiprocessed solutions. Usually you just see a small overhead increase unless you're doing something questionable like loading data structures over and over in all processes and the like.
May I recommend Stevens Unix Network Programming Vol 2: IPC to see some common designs of MP programs? You may see some large memory footprint gains by just looking through some of the programs in that book and rethinking your processing/responsibilities of your different processes.
I by no means think EVERYTHING should be multiprocessed, I just think MOST things can be equally well done with threads or processes, and MANY programmers have never seen multiprocess programs, especially large multiprocess programs, where most have worked in multithreaded programs (where there are more than 1 user threads).
Having worked with both, the errors you see in multiprocess programs are MUCH more traceable and manageable. Multi-threading errors can take months to debug sometimes, and weeks to even get a good reproduction scenario for. Then again, for a SMALL amount of concurrency, threading is simpler to setup and do for sure.
But don't fool yourself that "MOST" of anything works with any one architecture. It's a big world.
And I assure you I've read Stevens.
Some of us have been using mmapd surfaces with python/pygame for years though. For graphical work, it's not all that hard to share data with python. You can use the same approaches with numpy. See this cookbook example: http://www.pygame.org/wiki/MmapSurfaces it's only a dozen lines of code to share data via mmap. There are lots of issues with the python, and numpy mmap modules though... and mmap is very different across platforms (eg, linux, windows, macosx have quite different behaviour).
Another approach good for some graphics problems is forking. Forking is pretty fast, and it allows you to share memory in a fairly nice way. However mixing forking and threading is a quite tricky with python. This is also not so good on windows - mainly its a good method on *nix.
cu,
Of methods of concurrency that people use, there are two main approaches, threads, and multiprocessing. I just contend only about 15% of solutions are super clear winners for one or the other, leaving 65-70% of apps that can go either way.
And I'm not a web developer, I'm an embedded software developer with years of experience in embedded video, streaming video, and hardware emulation. Lots of THAT stuff also fits just fine in either system too. As does the test systems, large analytics programs, etc that I've seen unrelated to the field.
Actually python largely keeping to the inconsistency of the underlying OS with regards to mmap and other shared memory solutions is the biggest obstacles there. Oh, and the fact that hardcore numerics are still callouts to C libs in python.
>And I assure you I've read Stevens. Lots and lots of people read Vol1, it seems like 1/10th as many read Vol2. Hell, I'm pretty sure most people who read Vol1 haven't a clue what's in Vol2.
I'm by no means saying I want the GIL to say the same, I just think numerics work, graphics, games need threads, after that, you get to use either one (aka, 15% need threads, the other 85 need processes or can use either).
Unless you have overriding design restrictions (such as requiring privilege separated worker processes), it seems that the only genuine argument for the "multiprocessing" model is simply that Python doesn't support anything else.
I come from the "Why not at least look at multiprocessing" in C world as well. Threads are a way lots of very subtle bugs happen. It's a "all is well until someone loses an eye" type of situation.
Both are valid ways to solve problems, but both have their share of issues.
And they're not "significantly" more complicated if you're actually testing your code. Testing multi processed solutions is easy. Testing for threading issues is a pain in the ass.
And yes multi-threading errors can be difficult to debug, but all the approaches to avoid these errors can be used with threads just as well as with multiple processes. Message passing, features like those in Clojure or other functional languages, or Go's goroutines.
And to be honest, the fact that most people use threads when they don't actually need them or design their programs badly is a non issue for me. Most people are incredibly bad at most things I'm afraid. Does that mean Python should not empower people who know what they are doing?