Critical sections and mutexes

Graham Ashton graz at mindless.com
Sat Oct 27 08:17:42 EDT 2001


In article <mailman.1003979425.29107.python-list at python.org>, "brueckd"
<brueckd at tbye.com> wrote:

> With a very few multithreaded Python apps under your belt it gets so
> that it doesn't take too many brain cycles to recognize the
> GIL-does-this-for-free scenarios.

I take it that others (possibly significantly less experienced than you)
don't ever need to modify your software then? Adhering to basic principles
like using mutexs where people unfamiliar with your code would expect to
find them helps you to write self documenting code. It's not everybody
who has the experience you do of when you can get away without locks in
Python.

> Yes, you can always overengineer a solution if you want, but that's not
> very Pythonic.

Eh? Where is that written down then? Surely the amount of "engineering"
that goes into your software is defined by it's intended purpose? Perhaps
I'd better go and learn C.

> Think of it this way: the way the GIL works can impose a slight
> performance hit on your program (a cost). With that cost is an
> associated benefit. You can choose whether or not to enjoy that benefit,
> but you've already paid the cost so you might as well.

That's fine, so long as you bear in mind that it all depends on the domain
in which your software is intended to run. It's that kind of attitude that
lead to the Y2K problem.

--
Graham



More information about the Python-list mailing list