Shared Memory Modules

Thomas Heller theller at python.net
Tue Nov 25 13:18:33 EST 2003


Peter Hansen <peter at engcorp.com> writes:

> Thomas Heller wrote:
>> 
>> steven.green3 at baesystems.com (S Green) writes:
>> 
>> > Does any one now if a shared memory module exists, written in python
>> > for a windows platform. I now one exists for unix?
>> >
>> >
>> > help most appreciated,
>> >
>> > S Green
>> 
>> import mmap
>
> The docs suggest that mmap.mmap(x, x, mmap.MAP_SHARED) will work under
> Unix but not Windows.
>
> Does the Windows version really support shared memory, or is the 
> multiple-maps-per-file feature only valid within a single process?

Yes, it does.  You have to give this memory block a name, though:

sharedmem = mmap.mmap(0, 16384, "GlobalSharedMemory")

This allows to access 16384 bytes of memory, shared across processes,
not backed up by a file in the filesystem.

Thomas




More information about the Python-list mailing list