Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46314
| From | Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> |
|---|---|
| Subject | usage of os.posix_fadvise |
| Date | 2013-05-28 17:27 +0000 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2308.1369762047.3114.python-list@python.org> (permalink) |
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
usage of os.posix_fadvise Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-05-28 17:27 +0000
csiph-web