´ç¿¬È÷ ¿î¿µÃ¼Á¦´Â ´ç½ÅÀÇ ÇÁ·Î±×·¥ÀÌ Ç×»ó ¾öû³ ½Ã½ºÅÛÀÚ¿øÀ» ¾µ°Å¶ó°í »ý°¢ÇÏÁö ¾Ê´Â´Ù. ±×·¡¼ ´ëºÎºÐÀÇ °æ¿ì¿¡ Æò±ÕÀûÀÎ ÀÚ¿ø¸¸À» ¾µ ¼ö ÀÖµµ·Ï ÇÏ°í ÀÖ´Ù. ³ªÀÇ ½Ã½ºÅÛÀÌ Á¦°øÇØÁÖ´Â ÀÚ¿øÀ» È®ÀÎÇØ º¸ÀÚ.
1.1 /proc/sys/fs/file-max #
½Ã½ºÅÛ ÀüüÀûÀ¸·Î ¿ ¼ö ÀÖ´Â ÆÄÀÏ °¹¼ö Á¦ÇÑ. ÇÊÀÚ ½Ã½ºÅÛÀº 12440 À¸·Î µÇ¾î ÀÖ´Ù. C10k ¹®Á¦ ÇØ°áÀ» À§ÇØ 32K°³ Á¤µµ·Î ³Ë³ËÇÏ°Ô Àâ¾Æº»´Ù.
#cat /proc/sys/fs/file-max
12440
#echo 32768 > /proc/sys/fs/file-max
ÇÁ·Î¼¼½º Çϳª°¡ ¿ ¼ö ÀÖ´Â ÆÄÀÏ °¹¼ö Á¦ÇÑ.
#ulimit -n
1024
#ulimit -n 32768
1.3 Processes and Threads #
ÇÁ·Î¼¼½º °¹¼öÁ¦ÇÑ(Áï pidÀÇ max)°ú ¾²·¹µå °¹¼ö Á¦Çѵµ È®ÀÎÇØ º¸ÀÚ. ¾Æ·¡´Â ÇÊÀÚ ½Ã½ºÅÛ¿¡¼ È®ÀÎÇØ º» °Í.
#cat /proc/sys/kernel/pid_max
32768
#cat /proc/sys/kernel/threads-max
4094
1.4 getrlimit(), setrlimit() #
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
int getrlimit(int resource, struct rlimit *rlim);
int getrusage(int who, struct rusage *usage);
int setrlimit(int resource, const struct rlimit *rlim);
struct rlimit {
rlim_t rlim_cur; /* Soft limit */
rlim_t rlim_max; /* Hard limit (ceiling for rlim_cur) */
};
º¸´Ù ÀÚ¼¼ÇÑ ³»¿ëÀº man setrlimit Çغ¼ °Í.