Re:Data races in Python, despite the Global Interpreter Lock
by dzqhz on Monday February 21, 2022 @05:35PM
(#30421619)
I don't see how it could ever be interpreted the first way.
[ Parent
| on HN ]
Re:Data races in Python, despite the Global Interpreter Lock
by verdagon on Monday February 21, 2022 @05:42PM
(#30421698)
The article isn't trying to claim either interpretation, it's just using it as an example to show that the GIL doesn't actually help protect users from concurrency problems. You'd be surprised how many people think that!
I used to think that it did as well, but then my C/Java brain kicked in and realized that couldn't be correct. I wrote this article to help others see it in action.
Re:Data races in Python, despite the Global Interpreter Lock
by matheusmoreira on Monday February 21, 2022 @06:08PM
(#30421944)
> I used to think that it did as well
I did too. I even wrote multithreaded test programs to see if it was true: they would always give me consistent results on Python and Ruby but on Java and C data got clobbered as expected.
Re:Data races in Python, despite the Global Interpreter Lock
by tomp on Monday February 21, 2022 @06:22PM
(#30422066)
for example: "move money from one bank account to another bank account"
essentially the same operations in the same order, that need to be isolated (i.e. transactional / atomic) from concurrent threads performing the same operations.