[Python-ideas] Application awareness of memory storage classes
greg.ewing at canterbury.ac.nz
Wed May 18 18:41:37 EDT 2016
Terry Reedy wrote:
> I have long thought that I should be able to randomly access data on
> disk the same way I would access that same data in RAM, and not have to
> fiddle with seek and so on.
I gather Multics was like that -- the only way to access a
file was to map it into memory, like mmap() in unix.
I believe that some unix kernels also work that way
internally, with the file I/O layer being built on
top of the VM layer.
I can see some problems with trying to build that sort
of thing too deeply into Python, though. One of them
is what happens when two processes map in the same file
of Python objects. Some kind of super-GIL that works
between processes would be needed to manage the
Another thing is how to specify that particular
objects should be allocated in particular memory
areas. That could become quite tricky and tedious
with object allocation being both very frequent and
Another other thing is how to handle references that
cross different memory areas. Are they allowed? If
so, how do you manage them? If not, how do you detect
These problems are of course much reduced if you
only allow a restricted set of types to live in one
of these areas, such as only atomic types, and
lists, arrays, etc. of them. But then it feels more
like an I/O storage system like pickle or shelve
than it does a VM system.
More information about the Python-ideas