[Python-ideas] Concurrent safety?
Mike Meyer
mwm at mired.org
Tue Nov 1 16:25:08 CET 2011
On Mon, Oct 31, 2011 at 11:00 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:
> Mike Meyer wrote:
>
>> The goal here is to move from where we are to a place similar to where
>> handling files is, so that failing to properly deal with the possibility of
>> concurrent access causes an error when it happens, not at a point distant
>> in both time and space.
>>
>
> I don't think what you're suggesting would achieve this,
> though. The locking required for correctness often involves
> more than one object or more than one operation on an
> object. Consider
>
> new_balance = balance + deposit
> lock(balance)
> balance = new_balance
> unlock(balance)
>
> This wouldn't trigger any of your alarms, but it would
> still be wrong.
You're right - I chose my words poorly. As stated, solving it would involve
solving the halting problem. Replace the word "properly" with "at all".
I.e. - if you don't think about a concurrent access and should have, it'll
cause an error. If you think about it and get it wrong - well, nothing will
prevent all bugs. Partially automated resource allocation doesn't prevent
the programmer from writing bad code, and this is in that category.
<mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111101/937e6e11/attachment.html>
More information about the Python-ideas
mailing list