Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46314

usage of os.posix_fadvise

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'cache': 0.07; 'suppose': 0.07; 'parameter': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'seemed': 0.09; '4gb': 0.16; 'appreciated!': 0.16; 'caching': 0.16; 'flags,': 0.16; 'message- id:@post.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:mediaways.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:pool.mediaways.net': 0.16; 'subject:usage': 0.16; 'all,': 0.19; 'trying': 0.19; 'memory': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'question': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; "i'm": 0.30; 'once,': 0.31; 'file': 0.32; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'ubuntu': 0.36; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'new': 0.61; 'first': 0.61; 'dear': 0.65; 'subjectcharset:utf-8': 0.72; 'lack': 0.78; '(still': 0.84; 'subject:skip:o 10': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject usage of os.posix_fadvise
Date Tue, 28 May 2013 17:27:04 +0000 (UTC)
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host sea.gmane.org
User-Agent Loom/3.14 (http://gmane.org/)
X-Loom-IP 95.115.1.121 (Mozilla/5.0 (Windows NT 6.2; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2308.1369762047.3114.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369762047 news.xs4all.nl 15970 [2001:888:2000:d::a6]:35348
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46314

Show key headers only | View raw


Dear all,
I was just experimenting for the first time with os.posix_fadvise(), which
is new in Python3.3 . I'm reading from a really huge file (several GB) and I
want to use the data only once, so I don't want OS-level page caching. I
tried os.posix_fadvise with the os.POSIX_FADV_NOREUSE and with the
os.POSIX_FADV_DONTNEED flags, but neither seemed to have any effect on the
caching behaviour of Ubuntu (still uses all available memory to page cache
my I/O).
Specifically, I was trying this:

import os
fd = os.open('myfile', os.O_RDONLY)
# wasn't sure about the len parameter in fadvise,
# so thought I just use it on the first 4GB
os.posix_fadvise(fd, 0, 4000000000, os.POSIX_FADV_NOREUSE) # or DONTNEED

then reading from the file with os.read() .

By its very nature, I suppose posix_fadvise's effects will be OS-dependent,
so my question is whether the lack of effect I'm observing is something
Ubuntu-specific, or if I'm just using it in a wrong way.

Any help is greatly appreciated!
Best,
Wolfgang 

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

usage of os.posix_fadvise Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-05-28 17:27 +0000

csiph-web