On 10 September 2017 at 03:54, Nathaniel Smith <n...@pobox.com> wrote: > On Sep 9, 2017 9:07 AM, "Nick Coghlan" <ncogh...@gmail.com> wrote: > > > To immediately realise some level of efficiency benefits from the > shared memory space between the main interpreter and subinterpreters, > I also think these low level FIFOs should be defined as accepting any > object that supports the PEP 3118 buffer protocol, and emitting > memoryview() objects on the receiving end, rather than being bytes-in, > bytes-out. > > > Is your idea that this memoryview would refer directly to the sending > interpreter's memory (as opposed to a copy into some receiver-owned buffer)?
There are two possibilities that I think can be made to work. Option one would be a memoryview subclass that: 1. Also stores a reference to the source interpreter 2. Temporarily switches back to that interpreter when acquiring or releasing a buffer view The receiving interpreter would then also be able to acquire a suitable referencing to the sending interpreter for the message in order to establish bidirectional communications. Option two would be the same general idea, but with a regular memoryview placed in front of the subinterpreter aware variant (although it's less clear how we'd establish bidirectional comms channels in that case). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com