News for hackers. Stuff that matters.
Re:The Python GIL Visualized by ajross on Tuesday January 05, 2010 @12:50PM (#1032804)
That's a fair case, but it's not exactly a rebuttal to what I said either. If you can fit your problem into a multi-process solution (and most web stuff qualifies), then yes, there are many advantages there. But some problems benefit from both CPU parallelism and fast shared memory (think numerics work, graphics, games, data stores...). And this is an area that (due to the GIL contention visualized in the linked article) Python serves poorly.

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.

Re:The Python GIL Visualized by gte910h on Wednesday January 06, 2010 @11:44PM (#1036520)
>But don't fool yourself that "MOST" of anything works with any one architecture. It's a big world.

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).

Re:The Python GIL Visualized by illumen on Tuesday January 05, 2010 @01:28PM (#1032884)
pygame does a lot of its threaded graphics, and sound work entirely in C world, because python threads are so limited.

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,

Re:The Python GIL Visualized by gte910h on Wednesday January 06, 2010 @11:46PM (#1036525)
I'd love a good windows fork.....win7 hasn't implemented it yet I'm guessing?