[Sugar-devel] poor man's mmap "sliding window" on Python 2.5.x

Martin Langhoff martin.langhoff at gmail.com
Wed Jul 8 22:08:49 EDT 2009

On Thu, Jul 9, 2009 at 1:45 PM, John Gilmore<gnu at toad.com> wrote:
>> The process is doing a linear read through the file, and is slow
>> enough that it appears only to grow. But if I run another process that
>> allocates a lot of memory, then the kernel does discard pages pages.
> So are you saying that two identical processes that mmap large amounts
> of memory, (much larger than the DRAM and with no swap space), then
> walk sequentially through the memory, will split the memory evenly
> among them, and will complete in a reasonable amount of time.  But one
> process will get very slow and never complete?

No, something much simpler. No bug in the mmap implementation but in my testing.

I was testing with 1 process walking the file slowly & linearly.
Watching `top` it _looked_ like it was exhausting memory and getting
slower. The kernel did seem to discard other process' clean pages,
because all other processes were idle.

However, if instead of just watching top I start other processes, (a
Browse.xo instance), the kernel reacts quickly, discards old pages
from the test script, and Browse runs nicely.

So the problem was in my procedure. mmap works as it should.


 martin.langhoff at gmail.com
 martin at laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff

More information about the Devel mailing list