Re: Runtime File Descriptor settings

Anders Hammarquist (iko@netg.se)
Fri, 17 Apr 1998 23:00:39 +0200


>BSD/OS has the ability to automatically tune the max file descriptors per
>process at runtime. I was curious if anyone was working on such a thing for
>Linux.

Are you thinking of rlimits (which Linux also has), or is there some
way to change the size of the file table is BSD/OS? If the latter,
Linux can't do that (yet anyway).

>I ask this simply because I need 1024 fd's for a single process, but not for
>all processes. In fact, I want it to be capped at 256 for most processes.

You need to change NR_OPEN in
/usr/src/your-linux-source/include/linux/fs.h to raise the maximum
(which defaults to 256 in 2.0.x and 1024 in 2.1.x) and recompile. Then
set rlimits for your processes. You probably need to raise the total
number of open files and inodes on your system as well, that's
settable via the sysctl interface in /proc/sys/kernel/{file,inode}-max.

>That and I've heard that setting file descriptors in your kernel to 1024 or
>higher wastes a heck of a lot of RAM.

On 32-bit machines, its 64 bytes (unless I counted wrong) * NR_OPEN per
process (regardles of rlimits).

Regards,
/Anders

-- 
 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist   |       Mud at Kingdoms        | iko@netg.se
NetGuide Scandinavia |   telnet kingdoms.se 1812    | Fax: +46 31 50 79 39
http://www.netg.se   |                              | Tel: +46 31 50 79 40

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu