Process to use open files

I would like to test open files usage in my system, if I want to create a process ( or script ) that can use a certain amount ( eg. 1000 ) of open files , is it possible to create such process ( or script ) ?

Try ulimit -u first and see if that does not meet your needs.
Chack back with us if that will not do. But. Be forewarned:

1. some command line utilities like awk may have  predefined limits on open files, so you may have to write C, or C++ code to "test".

2. You are going to create lots of worthless files in order to test, 
   files that you need to clean up later, depending on how you write code
   or what tool you use.

3. Assume ulimit shows 4096
   you will need to try to open more files than that and look for an error
   and print the step (number of files) when it bombs

thanks reply ,

thanks reply ,

what I want to have a process that use open files up to a certain amount .

in my case , I have set the ulimit -u to 2048 in my system , I would like to have a process that will use the open files up to a certain amount eg. 1000 , that I can test my application when the current open files is at the amount of 1000 .

may I know if use a script which have a loop to open file continously , is it work ?

thanks

Do you trink that one process can steal file descriptors from another process??
It cannot. Each process has its own 1024 (or 2048 if set with ulimit) descriptors.

1 Like