05-22-2007
The exact particulars vary depending on OS. I will use HP-UX as an example. The number of possible file decriptors is under the control of
setrlimit(2). (A less powerful interface,
ulimit() is also available.) A process cannot have more fd's than the "soft" limit . Using setrlimit(2), a process may raise or lower its soft limit. But a process cannot raise the soft limit above the hard limit. A process can lower the hard limit. Only a root process can raise the hard limit. Kernel parameters define the initial value of the hard and soft limit. Even root cannot raise the hard limit above the initial value for the hard limit. The kernel paramters:
maxfiles
maxfiles_lim
I have cheated a little bit by picking HP-UX as my sample OS. HP-UX allows dynamic reconfiguration of the kernel. Only root can reconfigure the kernel. But a root process could, in theory, raise maxfiles_lim and then raise its hard limit and then relower maxfiles_lim. Not all versions of Unix give that much power to a root process.
I don't believe that cron fiddles with these limits.
10 More Discussions You Might Find Interesting
1. Programming
Hi,
I have written a daemon process, to perform certain operations in the background.
For this I have to close, the open file descriptors,
Does anybody know how to find out the number of open file descriptors ?
Thanks in Advance,
Sheetal (2 Replies)
Discussion started by: s_chordia
2 Replies
2. UNIX for Advanced & Expert Users
Hello all,
A few questions on file descriptors ...
scenario : Sun Ultra 30 with Sun OS 5.5.1 , E250 with Solaris 2.6
In one of my servers, the file descriptor status from the soft limit and hard limits are 64 and 1024 respectively for root user.
Is the soft limit (64) represents the... (3 Replies)
Discussion started by: shibz
3 Replies
3. UNIX for Dummies Questions & Answers
i m trying to learn processes in unix and i've been reading this but i don't quite get it. its regarding file descriptors. : each is a part of file pointers, they point to another area. indexes into an Operating system maintained table called "file descriptor table". one table per process. may... (3 Replies)
Discussion started by: a25khan
3 Replies
4. Programming
I am in a Systems programming class this semester, and our current project is to write a program utilizing sockets and fork. For the project, I decided to make my own instant messaging program. I have the code completed, but I have a problem that keeps old clients from communicating with new... (3 Replies)
Discussion started by: gstlouis
3 Replies
5. Shell Programming and Scripting
Need to close files which descriptor number are larger than 9 in ksh.
'exec 10>&-' fails with 'ksh: 10: not found'. How do you specify file descriptors which occupies two or more digits in ksh script?
Thanks,
Masaki (2 Replies)
Discussion started by: masaki
2 Replies
6. UNIX for Dummies Questions & Answers
Is it possible to write to file descriptor 0 and read from 1 or 2? How could this be implemented? (3 Replies)
Discussion started by: machshev
3 Replies
7. HP-UX
Hi,
I speak and write english more or less, so I hope my asking be clear.
:)
In the company I am working, they are using control-m software to lunch
shell scripts.
So i put this command in all shell scripts:
export LOGFILE_tmp=$PRODUC_DATA/tmp/${SCRIPT}_${PAIS}_`date... (0 Replies)
Discussion started by: anamcara
0 Replies
8. UNIX for Dummies Questions & Answers
What is the difference between a file descriptor and a semaphore?
My basic understanding is:
- a file descriptor is a small positive integer that the system uses instead of the file name to identify an open file or socket.
- a semaphore is a variable with a value that indicates the... (1 Reply)
Discussion started by: Mr_Webster
1 Replies
9. Shell Programming and Scripting
Hi all,
I've been looking for the way to send stdout and stderr to different files. Well, actually I really knew how to make it, but I wanted to be sure.
I've found an instruction very interesting which I'm not able to understand:
taken from this site. It says it sends stdout to output.log,... (4 Replies)
Discussion started by: AlbertGM
4 Replies
10. Shell Programming and Scripting
Hi, I'm playing with KSH
I entered following command in terminal
{ echo "stdout" >&1; echo "stderr" >&2; } > out
And I get only stoud in a new file out.
My question is: Where did my stderr vanish ? (5 Replies)
Discussion started by: solaris_user
5 Replies
LEARN ABOUT HPUX
maxfiles_lim
maxfiles_lim(5) File Formats Manual maxfiles_lim(5)
NAME
maxfiles_lim - hard maximum number of file descriptors per process
VALUES
Failsafe
Default
Allowed values
The minimum value allowed is 32. The maximum value allowed is 1048576, or 1M. The value is further constrained in that it must be equal
or greater than the soft limit,
Specify a positive integer value.
Recommended values
At runtime, a warning will be issued if the tunable is set to a value greater than 409600, or 400K. This is beyond the tested limit.
At runtime, a warning will be issued if the value is not a multiple of the file descriptor chunk (multiple of 8) size. This is not a seri-
ous warning, just an information message for the administrator.
DESCRIPTION
specifies the system hard limit for the number of file descriptors that a process is allowed to have for open files at any given time. It
is possible for a nonsuperuser process to increase its soft limit up to this hard limit.
Who Is Expected to Change This Tunable?
Anyone expecting to run applications using large numbers of file descriptors.
Restrictions on Changing
The tunable is dynamic (tuning will take effect immediately on the running system).
Dynamic changes affect all existing processes in the system except:
o Processes that have more file descriptors allocated than allowed by the new limit,
o Processes that have specifically set their limits through a call to or
When Should the Value of This Tunable Be Raised?
The tunable should be increased when large numbers of file descriptors are expected to be open by several processes.
What are the Side Effects of Raising the Value?
There is no immediate effect of raising the value of However, doing so allows any process to allocate more file descriptors, potentially
consuming more system memory.
When Should the Value of This Tunable Be Lowered?
The value should be lowered to limit the number of open file descriptors per process on a system and reduce system memory consumption.
What are the Side Effects of Lowering the Value?
Lowering the value of bounds memory consumption due to file descriptors for processes that are not already over the new limit.
What Other Tunable Values Should Be Changed at the Same Time?
The value assigned to must be less than or equal to the value of
Kernel checks during tunable setting ensure these restrictions.
WARNINGS
For values greater than 65535, compatibility for the obsolescent will be affected. For correct operation, all applications must use
instead of If the system still has applications using setting to 65535 or less will maintain compatibility, unless the process being
queried has used to change its maximum limit of open files to a value greater than 65535.
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its meaning changed in future releases of
HP-UX.
Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parameter values. After installation,
some tunable parameters may no longer be at the default or recommended values. For information about the effects of installation on tun-
able values, consult the documentation for the kernel software being installed. For information about optional kernel software that was
factory installed on your system, see at
AUTHOR
was developed by HP.
SEE ALSO
kctune(1M), sam(1M), setrlimit(2), gettune(2), settune(2), pstat(2), ulimit(2), maxfiles(5).
Tunable Kernel Parameters maxfiles_lim(5)