larryhastings / gilectomy

Gilectomy branch of CPython. Use "gilectomy" branch in git. Read the important, short README below!
Other
527 stars 43 forks source link

[idea] RCU #41

Open dimaqq opened 7 years ago

dimaqq commented 7 years ago

Linux kernel switched from spinlocks to seqlocks to RCU.

Perhaps there's a parallel with Python containers, at least. If two threads want to expand dict storage, perhaps it doesn't matter which thread's allocation is ultimately used. Likewise, if two threads want to list.append (blindly), it doesn't matter what order the entries are appended in.

The upside is no slowdown for reads (so reference counts are out).

dimaqq commented 7 years ago

There's an interesting interplay between RCU and GC -- in the kernel and refcount world, thread has to deallocate "old" data; but if datum is subject to GC, it can just leave garbage be.