[Python-Dev] PEP 509: Add a private version to dict

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Jan 21 00:20:42 EST 2016


Andrew Barnert via Python-Dev wrote:
> imagine someone manages to remove the GIL from CPython by using
> STM: now most transactions are bumping that global counter, meaning most
> transactions fail and have to be retried,

If this becomes a problem, the tag could be split into two
parts of m and n bits, with m + n = 64. Use a global counter
for allocating the high half, and increment the low half
locally. When the low half overflows, allocate a new high
half.

A value of n = 16 or so ought to reduce contention for the
global counter to something fairly negligible, I would
think, without much risk of the high half ever wrapping
around.

-- 
Greg


More information about the Python-Dev mailing list