3 ms·
If you restricted shared memory to objects explicitly declared as shared, you wouldn't need a GIL. You'd simply need per-object locks. For scientific computing
by yummyfajitas 17y ago
If you restricted shared memory to objects explicitly declared as shared, you wouldn't need a GIL. You'd simply need per-object locks.
For scientific computing purposes, you can often accomplish this with multiple processes and a numpy array allocated by shmget/shmat. But I'm not sure how to share complex objects in this way.
- nailer 17y agoI'm not quite sure if I'm right here (and I'd appreciate it if another HN reader corrected me). But I think that's how the Queue object in Python 2.6 works. The Queue instance is locked, you seem to be free to do whatever within the threads that are consuming the queue. The reason I'm not sure is that having a single object being locked seems to contradict the GIL concept...
- dkersten 17y ago...and if we moved away from the annoying-and-awkward shared memory model, then this becomes even less of a problem still.