Re: Shared Memory Modules

From: Peter Hansen (peter_at_engcorp.com)
Date: 11/25/03


Date: Tue, 25 Nov 2003 13:57:50 -0500

Thomas Heller wrote:
>
> Peter Hansen <peter@engcorp.com> writes:
>
> > Thomas Heller wrote:
> >>
> >> steven.green3@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.

Thanks, Thomas.

In my opinion the documentation on this is entirely unclear. I attach
it for reference, but I can't offer any suggestions for improvement (as
I don't know anything about shared memory) except that even after reading
it a second time, Thomas' answer above is very much news to me:

'''tagname, if specified and not None, is a string giving a tag name
for the mapping. Windows allows you to have many different mappings
against the same file. If you specify the name of an existing tag,
that tag is opened, otherwise a new tag of this name is created. If
this parameter is omitted or None, the mapping is created without a
name. Avoiding the use of the tag parameter will assist in keeping your
code portable between Unix and Windows. '''

(from http://www.python.org/doc/current/lib/module-mmap.html)

-Peter



Relevant Pages

  • Re: inconnectivity between windows ce and eCos
    ... I think that what you want is to know how to manage the shared memory. ... For the Windows CE CPU and your applications, you just need to make the ... > processor windows ce is running and in other processor eCOS is running, ... >> devices that happen to be running different operating systems? ...
    (microsoft.public.windowsce.platbuilder)
  • Re: need a way
    ... Now the last question,,, The shared memory system I am going to build needs ... In Windows terms, each application that is ... > efficient way, in Windows, is of course Windows Messaging. ... > means that your MainA has a single thread, ...
    (microsoft.public.dotnet.languages.vc)
  • Re: need a way
    ... The second thing you need is some sort of a messaging system. ... efficient way, in Windows, is of course Windows Messaging. ... MainB uses the shared memory access to get data from the shared memory ... MainC is responsible for sending the WM_CUSTOM_REFRESH_DATA to MainA. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Problem with access to shared memory(W2K) / ORIGINALLY (win32) speedfan api control
    ... Thomas Heller, ... pBuf is a pointer to a Buffer structure, ... > I get this error when I try to open a non-existing shared memory block. ... except that if the file is empty Windows raises an exception ...
    (comp.lang.python)
  • Re: Memory Leak pooltag="Ddk", windows xp media center 2004, what driver is this?
    ... Maxim Shatskih, Windows DDK MVP ... has a memory leak that I would like to get fixed, ... determined that something with the pool tag "Ddk" was eating up all the ...
    (microsoft.public.development.device.drivers)

Loading