![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| handling maximum number characters in an input file | chrysSty | UNIX and Linux Applications | 1 | 05-12-2008 07:19 AM |
| TO find the word which occurs maximum number of times | aajan | Shell Programming and Scripting | 5 | 01-11-2008 12:11 AM |
| Will the output file be opened and closed several times? | koifans | Shell Programming and Scripting | 7 | 12-28-2007 02:57 AM |
| ls - maximum number of files | karnan | UNIX for Dummies Questions & Answers | 5 | 12-10-2007 07:09 AM |
| Counting Number of times a File is accessed | pathanjalireddy | Shell Programming and Scripting | 1 | 04-11-2005 06:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
maximum number of times - a file can be opened
Hi All,
We can find the maximum of open file descriptors in hold with respect to a process. As default size was 256 (with getrlimit) and the hard limt was 65536 I tried changing the limit to 1024(with setrlimit) successfully changed the limit but still I couldnt have as many open file descriptors as I had mentioned in the setrlimit, I am just pushed off with 256 file descriptors itself. And one more, Though the process has limitations on the number of file descriptors it can have, is there any limit imposed indirectly on a file that it can have only 'n' number of active open(s). (virtually, I think it is not possible). say, File dum.c can be opened only 'Z' no of times. Any ptrs for the above!!! Thanks. |
| Forum Sponsor | ||
|
|
|
||||||
|
Quote:
Quote:
Quote:
Does that mean mapping a newly created file descriptor to an previously existing one ? ( I think I am wrong, tht cannot be the case) Quote:
Quote:
Quote:
literally, I cannot fork that many process to exploit vnode counter for any particular file |
|
||||
|
If you don't have root, ask your system administrator what nfile is. Be sure to explain that you plan to exploit a possible os weakness. We sysadms just love to hear that. I decline to comment on what result would ensue if you wrap the counter. (Which I doubt is possible.)
If I execute a single open(), followed by a dup(), I now have two open files but only one file table entry. (I did say this might be cheating.) If you doubt that this represents 2 open files, try it and run lsof on your program. Or suppose I do this and then I call exit(). All opened files are closed by exit(). How many times will exit invoke close()? Or leave your limit at 256 and open a file and dup it 256 times...do you succeed? And dup() is not the only way to duplicate an fd. There is even a way to "dup" an fd from one process to another unrelated process. Also only the original dup is constrained to the lowest available fd. It is better to control the desired fd. The original dup is really still around for compatibility. On most OS's, dup is just a wrapper around fcntl(). I know that duped fd's all link to the same file table entry...that is the whole point. It circumvents the nfile limit. And I point out one more time that I did say it might be cheating. Max pid may or may not relate strongly to max number of processes. Max processes is another kernel tunable called NPROC but there may be a limit how high it can be set. If you want to achieve the max number of times that a file can be opened, you will need to take extraordinary steps and this includes tuning the kernel to max out various limits. (Sadly, few kernels have been tuned for this particular activity...) This in turn may cause you to need a lot of physical memory. Setting records is never easy. |
||||
| Google The UNIX and Linux Forums |