[Python-Dev] mmapfile module

Gordon McMillan gmcm@hypernet.com
Tue, 16 Nov 1999 13:04:41 -0500


Andrew M. Kuchling wrote:

> Hmm... I don't know of any way to use mmap() on non-file things,
> either; there are odd special cases, like using MAP_ANONYMOUS on
> /dev/zero to allocate memory, but that's still using a file.  On
> the other hand, there may be some special case where you need to
> do that. We could add a fileno() method to get the file
> descriptor, but I don't know if that's useful to Windows.  (Is
> Sam Rushing, the original author of the Win32 mmapfile, on this
> list?)  
> 
> What do we do about the tagname, which is a Win32 argument that
> has no Unix counterpart -- I'm not even sure what its function
> is.

On Windows, a mmap is always backed by disk (swap 
space), but is not necessarily associated with a (user-land) 
file. The tagname is like the "name" associated with a 
semaphore; two processes opening the same tagname get 
shared memory.

Fileno (in the c runtime sense) would be useless on Windows. 
As with all Win32 resources, there's a "handle", which is 
analagous. But different enough, it seems to me, to confound 
any attempts at a common API.

Another fundamental difference (IIRC) is that Windows mmap's 
can be resized on the fly.

- Gordon