ÐÞ¸ÄLinux¿ÉÖ§³ÖµÄsocket×î´óÁ¬½ÓÊý
ÒýÓÃhttp://hi.baidu.com/fishzy0819/blog/item/76bc82347b94f681a61e1298.html
2009-10-25 15:43
×î½ü×ö¹«Ë¾·þÎñÆ÷³ÌÐò´Ówindowsµ½LinuxµÄÒÆÖ²¹¤×÷£¬ÎҵķþÎñÆ÷ʹÓõÄACEµÄEpollģʽ£¬Ö§³Ö2000¸öÁ¬½Ó¡£ÔÚLinuxϱàÒë·þÎñÆ÷³ÌÐòºó£¬ÔËÐУ¬±¨´íÁË¡£
²é
ÁË×ÊÁϺó·¢ÏÖÊÇ£¬ÔÚLinuxÏÂEpollģʽĬÈÏÖ»Ö§³Ö1024¸öÁ¬½Ó£¬ËùÒÔÎÒÃÇÒªÐÞ¸ÄÒ»ÏÂLinuxϵͳ¿É´ò¿ªµÄ×î´óÃèÊö·ûÏÞÖÆ¡£×î¼òµ¥µÄÐ޸ķ½·¨Äã
¿ÉÒÔÓÃulimit -n 3000
°ÑÔÊÐí×î´ó¿ª´òµÄÃèÊö·ûÐÞ¸ÄΪ3000£¬µ«ÊÇÔõô×ö£¬Ö»¶Ôµ±Ç°ÃüÁîÖն˴ò¿ªµÄÓ¦ÓóÌÐòÓÐЧ¡£ÒªÒ»ÀÍÓÀÒݵģ¬»¹ÊǵÃÐÞ¸Ä/etc/security
/limits ÅäÖÃÎļþ¡£
ÔÚÎļþÖÐÔö¼Ó
* soft nofile 3000
* hard nofile 20000
±£´æ£¬ÖØÆôϵͳ£¬¾ÍÉúЧÁË¡£
½âÊÍÒ»ÏÂÉÏÃæµÄÃüÁ
* ±íʾ¸ÃÅäÖöÔËùÓÐÓû§¾ùÓÐЧ
soft ±íʾ ¿ÉÒÔ³¬¹ýºóÃæµÄÅäÖÃÊý
hard ±íʾ ×î´ó²»Äܳ¬¹ýºóÃæµÄÅäÖÃÊý
nofile±íʾ ÎÒÃÇÕâ¸öÅäÖÃÊǶÔÃèÊö·ûµÄÅäÖÃ
Ïà¹ØÎĵµ£º
»ùÓÚI/O RegionµÄ²Ù×÷º¯Êý__XXX_region()£¬LinuxÔÚÍ·Îļþinclude/linux/ioport.hÖж¨ÒåÁËÈý¸ö¶ÔI/OÄÚ´æ×ÊÔ´½øÐвÙ×÷µÄºê£º
¡¡¡¡¢Ùrequest_mem_region()ºê£¬ÇëÇó·ÖÅäÖ¸¶¨µÄI/OÄÚ´æ×ÊÔ´¡£
¡¡¡¡¢Úcheck_ mem_region()ºê£¬¼ì²éÖ¸¶¨µÄI/OÄÚ´æ×ÊÔ´ÊÇ·ñÒѱ»Õ¼Óá£
¡¡¡¡¢Ûrelease_ mem_region()ºê£¬ÊÍ·ÅÖ¸¶¨µÄI/OÄÚ´æ×ÊÔ ......
¾¡¹ÜLinux¿ª·¢µÄÏà¹Ø¸ÚλºÜ¶à£¬µ«³¤ÆÚÒÔÀ´Linux¿ª·¢Ã»ÓÐͳһµÄ¿ª·¢Æ½Ì¨£¬´ó¶àÊýµÄ¿ª·¢Õ߶¼Ö±½ÓʹÓÃVI¡¢GCCµÈÃüÁîÐй¤¾ß£¬ÕâÑùÆäʵ²»ÀûÓÚ´óÐÍÏîÄ¿µÄ¿ª·¢¡£ 1.ÒÀÈ»ÊÇÊìϤµÄ¿ª·¢Á÷³Ì ÔÚLinux²Ù×÷ϵͳÖУ¬CÓïÑÔ³ÌÐòµÄ¿ª·¢ºÍÆäËû»·¾³ÀàËÆ£¬³ÌÐòÉú³ÉÖ÷Òª·Ö³É±àÒë¡¢»ã±à¡¢Á¬½ÓµÈ¼¸¸ö²½Öè¡£ ± ......
¹ØÓÚlinuxµÄ¶Áд²Ù×÷
½¨Á¢ÁËÁ¬½Ó,¾Í¿ÉÒÔ½øÐÐͨѶÁË,ÍùÎļþÃèÊö·ûÀï¶Áд,ºÍ¶ÁдÎļþÊÇÒ»ÑùµÄ.
дº¯Êý:
ssize_t write(int fd,(void *)buf,size_t nbytes)
½«bufÖеÄnbytesдÈëµ½fdÖÐ,³É¹¦Ê±·µ»ØËùдµÄ×Ö½ÚÊý,ʧ°Üʱ·µ»Ø-1,²¢Ð´Èëerrno±äÁ¿.
µ±ÎÒÃÇÏóÌ×½Ó×ÖдÊý¾Ýʱ,¿ÉÄÜ»áÓÐÁ½ÖÖÇé¿ö:
a.writeµÄ·µ»ØÖµ´óÓÚ0,±íʾ ......
KS2009: How Google uses Linux
By Jonathan Corbet
October 21, 2009
LWN's 2009 Kernel Summit coverage
There may be no single organization which runs more Linux systems than Google. But the kernel development community knows little about how Google uses Linux and what sort of problems are ......
ÒýÓÃhttp://hi.baidu.com/tim_bi/blog/item/f1038ed6e3399d2707088bb3.html
2009-02-28 22:58
×î½ü½ÓµÄÏîÄ¿ÊÇÄ£Äâ¶à¸ö
socket
¿Í»§¶ËÓë·þÎñÆ÷½øÐÐͨÐÅ¡£ÓÉÓÚ
Linux
ϵͳµÄÏÞÖÆ£¬ÔÚ
linux/include/linux/posix_types.h
ÎļþÖÐÓÐÈçϵĺ궨Ò壺
#undef __FD_SETSIZE
#define __FD_SETSIZE
1024
Õâ¸öºêÊ ......