Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28567
| Date | 2012-09-06 12:00 +0200 |
|---|---|
| From | Laszlo Nagy <gandalf@shopzeus.com> |
| Subject | Re: Looking for an IPC solution |
| References | <mailman.9.1346440878.27098.python-list@python.org> <40ab9c6f-737e-47e3-950b-558472ad4a09@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.285.1346925623.27098.python-list@python.org> (permalink) |
> Hi Laszlo, > > There aren't a lot of ways to create a Python object in an "mmap" buffer. "mmap" is conducive to arrays of arrays. For variable-length structures like strings and lists, you need "dynamic allocation". The C functions "malloc" and "free" allocate memory space, and file creation and deletion routines operate on disk space. However "malloc" doesn't allow you to allocate memory space within memory that's already allocated. Operating systems don't provide that capability, and doing it yourself amounts to creating your own file system. If you did, you still might not be able to use existing libraries like the STL or Python, because one address might refer to different locations in different processes. > > One solution is to keep a linked list of free blocks within your "mmap" buffer. It is prone to slow access times and segment fragmentation. Another solution is to create many small files with fixed-length names. The minimum file size on your system might become prohibitive depending on your constraints, since a 4-byte integer could occupy 4096 bytes on disk or more. Or you can serialize the arguments and return values of your functions, and make requests to a central process. I'm not sure about the technical details, but I was said that multiprocessing module uses mmap() under windows. And it is faster than TCP/IP. So I guess the same thing could be used from zmq, under Windows. (It is not a big concern, I plan to operate server on Unix. Some clients might be running on Windows, but they will use TCP/IP.)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Looking for an IPC solution Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-31 21:04 +0200
Re: Looking for an IPC solution Marco Nawijn <nawijn@gmail.com> - 2012-08-31 13:25 -0700
Re: Looking for an IPC solution Marco Nawijn <nawijn@gmail.com> - 2012-08-31 13:25 -0700
Re: Looking for an IPC solution Paul Rubin <no.email@nospam.invalid> - 2012-08-31 13:36 -0700
Re: Looking for an IPC solution Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-31 23:10 +0200
Re: Looking for an IPC solution Wolfgang Keller <feliphil@gmx.net> - 2012-09-01 14:55 +0200
Re: Looking for an IPC solution vasudevram <vasudevram@gmail.com> - 2012-09-03 14:43 -0700
Re: Looking for an IPC solution Laszlo Nagy <gandalf@shopzeus.com> - 2012-09-06 12:13 +0200
Re: Looking for an IPC solution Aaron Brady <castironpi@gmail.com> - 2012-09-01 19:10 -0700
Re: Looking for an IPC solution Laszlo Nagy <gandalf@shopzeus.com> - 2012-09-06 12:00 +0200
Re: Looking for an IPC solution Aaron Brady <castironpi@gmail.com> - 2012-09-01 19:10 -0700
csiph-web