|
|
Log in / Subscribe / Register

Modifying the Python object model

Modifying the Python object model

Posted May 17, 2018 1:15 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
In reply to: Modifying the Python object model by roc
Parent article: Modifying the Python object model

You need interlocked operations for refcounts if you want multithreading. This causes merry hell with cache lines bouncing around.


to post comments

Modifying the Python object model

Posted May 17, 2018 10:06 UTC (Thu) by roc (subscriber, #30627) [Link] (2 responses)

Sure, but the Python interpreter can't share object between threads and the article doesn't say anything about changing that.

Modifying the Python object model

Posted May 18, 2018 14:59 UTC (Fri) by mb (subscriber, #50428) [Link] (1 responses)

Of course objects can be shared. That is the whole point of threads.

Modifying the Python object model

Posted May 18, 2018 22:00 UTC (Fri) by roc (subscriber, #30627) [Link]

OK that's true, but all access to Python objects is protected by the GIL so there is no need to use atomic operations to modify the refcount. (I should have said that objects can't be shared by concurrently executing threads.)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds