Results 1 to 2 of 2
Hi All,
I know that there is an OS limitation on the number of files that can be kept open for writing simultaneously.
However, I want to somehow overcome this ...
- 11-18-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 43
large number of simultaneous open files
Hi All,
I know that there is an OS limitation on the number of files that can be kept open for writing simultaneously.
However, I want to somehow overcome this limitation.
Let's say, if I have to process X number of files simultaneously at a certain time, where X is greater than the number of simultaneously open files that OS can handle, it seems to be the only solution to close the oldest files which were opened before any others first, and open the new ones instead.
Maybe a circular buffer or something similar is needed for this.
What is the best way to handle such a scenario in Linux using C++ ?
What Linux system function gives me the number of files that I can keep open at a certain time ?
Thanks.
- 11-18-2009 #2Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
I don't use this very often, so I needed to search for keywords in man page titles. It's a configuration value, so I look for config, and then filter those results for system:
and getconf looks like the command to use, but man getconf does not tell me directly what variable to look for. However, the reference at the bottom of man getconf suggests I look at man sysconf, in which I find:Code:% man -k config | grep system getconf (1) - Query system configuration variables paperconfig (8) - configure the system default paper size system-config-printer (1) - configure a CUPS server system-config-printer-applet (1) - print job manager
which, when used, produces on Debian 5 and CentOS 5.4:Code:OPEN_MAX - _SC_OPEN_MAX The maximum number of files that a process can have open at any time. Must not be less than _POSIX_OPEN_MAX (20).
After reading both man pages, it might be reasonable to test that value with a short program to be sure it's what you want.Code:% getconf OPEN_MAX 1024
Best wishes ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote