Skip to content

It looks like the GIL isn't released #2635

@jimfulton

Description

@jimfulton

Some of us were looking at ways to process images concurrently: https://github.com/ConcurrentPython/Parallel_Image_Processing

We assumed that PIL would release the GIL while doing image processing and that threads would be beneficial. However while running under threads, the test script (threaded.py) used more CPUs, but it didn't use much more than one CPU cumulatively and didn't run much faster than processing images sequentially (linear.py). Using multiprocessing, however, all of the CPUs (testing on an 8-cpu ec2 instance) were used and the test completed much faster, as expected.

Looking at the C sources, I don't see any calls to Py_BEGIN_ALLOW_THREADS, so I'm guessing that the GIL isn't released. This seems to be a lost opportunity. But I'm probably missing something.

This was with Python 3.6.1 built from source on ubuntu 16.04 and Pillow 4.2.1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions