Fast way to send message between 2 child processes? (using a file is too slow?)

Jeff Epler jepler at unpythonic.net
Wed Mar 10 04:07:28 CET 2004


On Wed, Mar 10, 2004 at 01:49:03PM +1100, Andrew Bennetts wrote:
> Oh!  I didn't know about os.sysconf... I wonder if that's better or worse
> than resource.getrlimit(resource.RLIMIT_NOFILE)?

sysconf(3) is POSIX.1, getrlimit() is "SVr4, BSD 4.3".  On my system
(fedora core 1), they give the same results when I tested them:

$ python -c 'import resource, os; print resource.getrlimit(resource.RLIMIT_NOFILE), os.sysconf("SC_OPEN_MAX")'
(1024L, 1024L) 1024

# In a fresh shell
$ ulimit -n 256
$ python -c 'import resource, os; print resource.getrlimit(resource.RLIMIT_NOFILE), os.sysconf("SC_OPEN_MAX")'
(256L, 256L) 256

# In a fresh shell
$ ulimit -S -n 256
$ python -c 'import resource, os; print resource.getrlimit(resource.RLIMIT_NOFILE), os.sysconf("SC_OPEN_MAX")'
(256L, 1024L) 256

Jeff




More information about the Python-list mailing list