newbie question

S

shama.bell

Hello,

How do i create two memory mapped buffers(mmap) and pass an index to
select which one needs to be populated?

Is it possible to define the size of the buffer?

-SB
 
S

Sean Blakey

Hello,

How do i create two memory mapped buffers(mmap) and pass an index to
select which one needs to be populated?

Is it possible to define the size of the buffer?

-SB

http://docs.python.org/lib/module-mmap.html

I haven't tried it, but it should be pretty straightforward to create
two mmaped buffers.

Step 1: Import the mmap module.

Step 2: Create or find the file you want to map. Open it, and get the
fileno. Call mmap.mmap, passing the fileno and buffer size.

Repeat Step 2 with a different file to create a second mmaped buffer.

I'm not sure what you mean by "and pass an index to select which one
needs to be populated". If you pack the buffers into a
tuple/list/other sequence object, it should be easy to access them by
index:
buffers = (buffer_1, buffer_2)
do_something_to(buffers[0])
do_something_else_with(buffers[1])

To mmap buffers, you MUST define the size.

I'm sorry I can't be more helpful; perhaps if you gave a higher-level
description of what you are trying to accomplish, I could give better
pointers in the right direction.
 
S

shama.bell

Whats the file that has to be mapped? Can this be a list? Can this list
be initialized to 512?

Thanks,
-SB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,230
Messages
2,571,161
Members
47,796
Latest member
AlphonseNa

Latest Threads

Top