According to this tutorial, you can get the maximum number of open file handles from a call to cat /proc/sys/fs/file-max
. On my system, I get a value of 797736, which is pretty big. A quick ps -e|wc -l
tells me I have about 200 processes running, which means any given program can open around 4000 file handles.
However, that is a global value - you can get more specific, by using ulimit. ulimit -a
reports that I can have a maxmimum of 1024 file handles open, which is still a pretty big number, although nothing compared to the absolute max. But, this can be increased if you need it to be and so isn't really a hard limit.
So, my conclusion? File handles are not a scarce resource. The tutorials just want to make sure you only open files while you need them, because if you leave file handles open it can interfere with other processes that might also be trying to work with the files, particularly if you are locking them when you open them.