[Python-Dev] SRE should release the GIL (was: no subject)

"Martin v. Löwis" martin at v.loewis.de
Thu Nov 24 23:51:15 CET 2005


Duncan Grisby wrote:
> Is there any fundamental reason why the re module cannot release the
> interpreter lock, for at least some of the time it is running?  The
> ideal situation for me would be if it could do most of its work with
> the lock released, since the software is running on a multi processor
> machine that could productively do other work while the re is being
> processed. Failing that, could it at least periodically release the
> lock to give other threads a chance to run?

Formally: no; it access a Python string/Python unicode object all
the time.

Now, since all the shared objects it accesses are immutable, likely
no harm would be done releasing the GIL. I think SRE was originally
also intended to operate on array.array objects; this would have
caused bigger problems. Not sure whether this is still an issue.

Regards,
Martin


More information about the Python-Dev mailing list