linuxÏÂulimitÃüÁîÏê½â
1,˵Ã÷:
ulimitÓÃÓÚshellÆô¶¯½ø³ÌËùÕ¼ÓõÄ×ÊÔ´.
2,Àà±ð:
shellÄÚ½¨ÃüÁî
3,Óï·¨¸ñʽ:
ulimit [-acdfHlmnpsStvw] [size]
4,²ÎÊý½éÉÜ:
-H ÉèÖÃÓ²¼þ×ÊÔ´ÏÞÖÆ.
-S ÉèÖÃÈí¼þ×ÊÔ´ÏÞÖÆ.
-a ÏÔʾµ±Ç°ËùÓеÄ×ÊÔ´ÏÞÖÆ.
-c size:ÉèÖÃcoreÎļþµÄ×î´óÖµ.µ¥Î»:blocks
-d size:ÉèÖÃÊý¾Ý¶ÎµÄ×î´óÖµ.µ¥Î»:kbytes
-f size:ÉèÖô´½¨ÎļþµÄ×î´óÖµ.µ¥Î»:blocks
-l size:ÉèÖÃÔÚÄÚ´æÖÐËø¶¨½ø³ÌµÄ×î´óÖµ.µ¥Î»:kbytes
-m size:ÉèÖÿÉÒÔʹÓõij£×¤ÄÚ´æµÄ×î´óÖµ.µ¥Î»:kbytes
-n size:ÉèÖÃÄں˿ÉÒÔͬʱ´ò¿ªµÄÎļþÃèÊö·ûµÄ×î´óÖµ.µ¥Î»:n
-p size:ÉèÖùܵÀ»º³åÇøµÄ×î´óÖµ.µ¥Î»:kbytes
-s size:ÉèÖöÑÕ»µÄ×î´óÖµ.µ¥Î»:kbytes
-t size:ÉèÖÃCPUʹÓÃʱ¼äµÄ×î´óÉÏÏÞ.µ¥Î»:seconds
-v size:ÉèÖÃÐéÄâÄÚ´æµÄ×î´óÖµ.µ¥Î»:kbytes 5,¼òµ¥ÊµÀý:
5.¾ÙÀý
ÔÚLinuxÏÂд³ÌÐòµÄʱºò£¬Èç¹û³ÌÐò±È½Ï´ó£¬¾³£»áÓöµ½“¶Î´íÎ󔣨segmentation
fault£©ÕâÑùµÄÎÊÌ⣬ÕâÖ÷Òª¾ÍÊÇÓÉÓÚLinuxϵͳ³õʼµÄ¶ÑÕ»´óС£¨stack size£©Ì«Ð¡µÄÔµ¹Ê£¬Ò»°ãΪ10M¡£ÎÒÒ»°ã°Ñstack
sizeÉèÖóÉ256M£¬ÕâÑù¾ÍûÓжδíÎóÁË£¡ÃüÁîΪ£º
ulimit -s 262140
Èç¹ûҪϵͳ×Ô¶¯¼ÇסÕâ¸öÅäÖ㬾ͱà¼/etc/profileÎļþ£¬ÔÚ “ulimit -S -c 0 > /dev/null
2>&1”ÐÐÏ£¬Ìí¼Ó“ulimit -s 262140”£¬±£´æÖØÆôϵͳ¾Í¿ÉÒÔÁË£¡
1]ÔÚRH8µÄ»·¾³Îļþ/etc/profileÖÐ,ÎÒÃÇ¿ÉÒÔ¿´µ½ÏµÍ³ÊÇÈçºÎÅäÖÃulimitµÄ:
#grep ulimit /etc/profile
ulimit -S -c 0 > /dev/null 2>&1
ÕâÌõÓï¾äÉèÖÃÁ˶ÔÈí¼þ×ÊÔ´ºÍ¶ÔcoreÎļþ´óСµÄÉèÖÃ
2]Èç¹ûÎÒÃÇÏëÒª¶ÔÓÉshell´´½¨µÄÎļþ´óС×÷ЩÏÞÖÆ,Èç:
#ll h
-rw-r--r-- 1 lee lee 150062 7ÔÂ 22 02:39 h
#ulimit -f 100 #ÉèÖô´½¨ÎļþµÄ×î´ó¿é(Ò»¿é=512×Ö½Ú)
#cat h>newh
File size limit exceeded
#ll newh
-rw-r--r-- 1 lee lee 51200 11ÔÂ 8 11:47 newh
ÎļþhµÄ´óСÊÇ150062×Ö½Ú,¶øÎÒÃÇÉ趨µÄ´´½¨ÎļþµÄ´óСÊÇ512×Ö½Úx100¿é=51200×Ö½Ú
µ±È»ÏµÍ³¾Í»á¸ù¾ÝÄãµÄÉèÖÃÉú³ÉÁË51200×Ö½ÚµÄnewhÎļþ.
3]¿ÉÒÔÏñʵÀý1]Ò»Ñù,°ÑÄãÒªÉèÖõÄulimit·ÅÔÚ/etc/profileÕâ¸ö»·¾³ÎļþÖÐ.
ÓÃ;
ÉèÖûò±¨¸æÓû§×ÊÔ´¼«ÏÞ¡£
Óï·¨
ulimit [ -H ] [ -S ] [ -a ] [ -c ] [ -d ] [ -f ] [ -m ] [ -n ] [ -s ] [
-t ] [ Limit ]
ÃèÊö
ulimit ÃüÁîÉèÖûò±¨¸æÓû§½ø³Ì×ÊÔ´¼«ÏÞ£¬Èç /etc/security/limits ÎļþËù¶¨Òå¡£Îļþ°üº
Ïà¹ØÎĵµ£º
LinuxϵͳϵÄGcc£¨GNU C Compiler£©ÊÇGNUÍƳöµÄ¹¦ÄÜÇ¿´ó¡¢ÐÔÄÜÓÅÔ½µÄ¶àƽ̨±àÒëÆ÷£¬ÊÇGNUµÄ´ú±í×÷Æ·Ö®Ò»¡£gccÊÇ¿ÉÒÔÔÚ¶àÖÖÓ²Ìåƽ̨ÉϱàÒë³ö¿ÉÖ´ÐгÌÐòµÄ³¬¼¶±àÒëÆ÷£¬ÆäÖ´ÐÐЧÂÊÓëÒ»°ãµÄ±àÒëÆ÷Ïà±Èƽ¾ùЧÂÊÒª¸ß20%~30%¡£ Gcc±àÒëÆ÷Äܽ«C¡¢C++ÓïÑÔÔ´³ÌÐò¡¢»ã³Ìʽ»¯ÐòºÍÄ¿±ê³ÌÐò±àÒë¡¢Á¬½Ó³É¿ÉÖ´ÐÐÎļþ£¬Èç¹ûûÓиø³ö¿ÉÖ´ÐÐÎÄ ......
1. Sed¼ò½é
sed ÊÇÒ»ÖÖÔÚÏß±à¼Æ÷£¬ËüÒ»´Î´¦ÀíÒ»ÐÐÄÚÈÝ¡£´¦Àíʱ£¬°Ñµ±Ç°´¦ÀíµÄÐд洢ÔÚÁÙʱ»º³åÇøÖУ¬³ÆΪ“ģʽ¿Õ¼ä”£¨pattern
space£©£¬½Ó×ÅÓÃsedÃüÁî´¦Àí»º³åÇøÖеÄÄÚÈÝ£¬´¦ÀíÍê³Éºó£¬°Ñ»º³åÇøµÄÄÚÈÝËÍÍùÆÁÄ»¡£½Ó×Å´¦ÀíÏÂÒ»ÐУ¬ÕâÑù
1. Sed¼ò½é
sed ÊÇÒ»ÖÖÔÚÏß±à¼Æ÷£¬ËüÒ»´Î´¦ÀíÒ»ÐÐÄÚÈÝ¡£´¦Àíʱ£¬°Ñ ......
ÎļþϵͳºÍÄÚ´æ¹ÜÀí£¬ÒÔ¼°½ø³Ì¹ÜÀíÊDzÙ×÷ϵͳµÄºËÐIJ¿·Ö¡£Êý¾Ýͨ³£ÒÔÎļþµÄÐÎʽ´æ´¢ÔÚÉè ±¸ÉÏ£¬Òò´ËÎļþϵͳµÄ»ù±¾¹¦ÄܾÍÊÇÒÔijÖÖ¸ñʽ´æÈ¡/¿ØÖÆÎļþ¡£0.11°æµÄÄÚºËÖвÉÓÃÁËminix1.0°æµÄÎļþϵͳ¡£ÔÚ×îеÄ2.6°æÄÚºËÖУ¬½èÖúÓÚ VFS£¬ÏµÍ³Ö§³Ö50¶àÖÖÎļþϵͳ¡£
Ê×ÏȽéÉÜÒ»ÏÂminixÎļþϵͳ
minixÎļþϵͳºÍ±ê×¼unixÎļþϵͳ» ......