Windows Socket I/OÄ£ÐÍ ÒÔ¼° Linux EpollÄ£ÐÍ
±¾Îļòµ¥½éÉÜÁ˵±Ç°WindowsÖ§³ÖµÄ¸÷ÖÖSocket I/OÄ£ÐÍ£¬Èç¹ûÄã·¢ÏÖÆäÖдæÔÚʲô´íÎóÇëÎñ±Ø´Í½Ì¡£
Ò»£ºselectÄ£ÐÍ
¶þ£ºWSAAsyncSelectÄ£ÐÍ
Èý£ºWSAEventSelectÄ£ÐÍ
ËÄ£ºOverlapped I/O ʼþ֪ͨģÐÍ
Î壺Overlapped I/O Íê³ÉÀý³ÌÄ£ÐÍ
Áù£ºIOCPÄ£ÐÍ
ÀϳÂÓÐÒ»¸öÔÚÍâµØ¹¤×÷µÄÅ®¶ù£¬²»Äܾ³£»ØÀ´£¬ÀϳºÍËýͨ¹ýÐżþÁªÏµ¡£ËûÃǵÄÐŻᱻÓʵÝԱͶµÝµ½ËûÃǵÄÐÅÏäÀï¡£
ÕâºÍSocketÄ£Ðͷdz£ÀàËÆ¡£ÏÂÃæÎÒ¾ÍÒÔÀϳ½ÓÊÕÐżþΪÀý½²½âSocket I/OÄ£ÐÍ~~~
Ò»£ºselectÄ£ÐÍ
Àϳ·dz£Ïë¿´µ½Å®¶ùµÄÐÅ¡£ÒÔÖÁÓÚËûÿ¸ô10·ÖÖÓ¾ÍÏÂÂ¥¼ì²éÐÅÏ䣬¿´ÊÇ·ñÓÐÅ®¶ùµÄÐÅ~~~~~
ÔÚÕâÖÖÇé¿öÏ£¬"ÏÂÂ¥¼ì²éÐÅÏä"È»ºó»Øµ½Â¥Éϵ¢ÎóÁËÀϳÂÌ«¶àµÄʱ¼ä£¬ÒÔÖÁÓÚÀϳÂÎÞ·¨×öÆäËû¹¤×÷¡£
selectÄ£ÐͺÍÀϳµÄÕâÖÖÇé¿ö·Ç³£ÏàËÆ£ºÖܶø¸´Ê¼µØÈ¥¼ì²é......Èç¹ûÓÐÊý¾Ý......½ÓÊÕ/·¢ËÍ.......
ʹÓÃÏß³ÌÀ´selectÓ¦¸ÃÊÇͨÓõÄ×ö·¨£º
procedure TListenThread.Execute;
var
addr : TSockAddrIn;
fd_read : TFDSet;
timeout : TTimeVal;
ASock,
MainSock : TSocket;
len, i : Integer;
begin
MainSock := socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
addr.sin_family := AF_INET;
addr.sin_port := htons(5678);
addr.sin_addr.S_addr := htonl(INADDR_ANY);
bind( MainSock, @addr, sizeof(addr) );
listen( MainSock, 5 );
while (not Terminated) do
begin
FD_ZERO( fd_read );
FD_SET( MainSock, fd_read );
timeout.tv_sec := 0;
timeout.tv_usec := 500;
if select( 0, @fd_read, nil, nil, @timeout ) > 0 then //ÖÁÉÙÓÐ1¸öµÈ´ýAcceptµÄconnection
begin
if FD_ISSET( MainSock, fd_read ) then
begin
for i:=0 to fd_read.fd_count-1 do //×¢Ò⣬fd_count <= 64£¬Ò²¾ÍÊÇ˵selectÖ»ÄÜͬʱ¹ÜÀí×î¶à64¸öÁ¬½Ó
begin
len := sizeof(addr);
ASock := accept( MainSock, addr, len );
if ASock <> INVALID_SOCKET then
....//ΪASock´´½¨Ò»¸öеÄỊ̈߳¬ÔÚеÄÏß³ÌÖÐÔÙ²»Í£µØselect
end;
end;
end;
end; //while (not self.Terminated)
shutdown( MainSock, SD_BOTH );
closesocket( MainSock );
end;
¶þ£ºWSAAsyncSelectÄ£ÐÍ
ºóÀ´£¬ÀϳÂʹÓÃÁË΢Èí¹«Ë¾µÄÐÂʽÐÅÏä¡£ÕâÖÖÐÅÏä·Ç³£ÏȽø£¬Ò»µ©ÐÅÏäÀïÓÐеÄÐżþ£¬¸Ç´Ä¾Í»á¸øÀϳ´òµç»°£ºÎ¹£¬´óÒ¯£¬ÄãÓÐеÄÐżþÁË£¡´Ó´Ë£¬ÀϳÂÔÙÒ²²»±ØƵ·±ÉÏÏÂÂ
Ïà¹ØÎĵµ£º
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
limits.conf Îļþʵ¼ÊÊÇ Linux PAM£¨²åÈëʽÈÏ֤ģ¿é£¬Pluggable Authentication Modules£©ÖÐ pam_limits.so µÄÅäÖÃÎļþ£¬¶øÇÒÖ»Õë¶ÔÓÚµ¥¸ö»á»°¡£
limits.confµÄ¸ñʽÈçÏ£º
username|@groupname type resource limit
username|@groupname£ºÉèÖÃÐèÒª±»ÏÞÖƵÄÓû§Ãû£¬×éÃûÇ°Ãæ¼Ó@ºÍÓû§ÃûÇø±ð¡£Ò²¿ÉÒÔÓÃͨÅä·û*À´×öËùÓÐÓû§ ......
LinuxÏÂcoreÎļþµ÷ÊÔ·½·¨
ÔÚ³ÌÐò²»Ñ°³£Í˳öʱ£¬Äں˻áÔÚµ±Ç°¹¤×÷Ŀ¼ÏÂÉú³ÉÒ»¸öcoreÎļþ£¨ÊÇÒ»¸öÄÚ´æÓ³Ïñ£¬Í¬Ê±¼ÓÉϵ÷ÊÔÐÅÏ¢£©¡£Ê¹ÓÃgdbÀ´²é¿´coreÎļþ£¬¿ÉÒÔָʾ³öµ¼Ö³ÌÐò³ö´íµÄ´úÂëËùÔÚÎļþºÍÐÐÊý¡£
1.coreÎļþµÄÉú³É¿ª¹ØºÍ´óСÏÞÖÆ
1£©Ê¹ÓÃul ......
¡¡Èç¹ûÄã°®ºÃѧϰ֪ʶ£¬ÓÈÆäÊÇLinux²Ù×÷ϵͳ֪ʶ£¬Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹£¬Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¿ÉÄã²»ÖªµÀÈ¥ÄÄÀïÕÒµ½ÕâЩ֪ʶ£¬À´ÕâÀÈÃÄã¸ü¼ÓÁ˽âLinuxѧϰ·½·¨¡£ÈÃÄãÈ«ÃæÕÆÎÕLinuxѧϰ·½·¨¡£
1£®Ñ§Ï°µÄÄ¿µÄ
¡¡¡¡Í¨¹ýLinuxµÄѧϰÕÆÎÕUNIXµÄÄ¿µÄÏë±Ø²»Óöà˵ÁË£¬ÔÚÕâ¸öÍøÂçÈ˲ÅÉí¼Û±¶ÔöµÄÄê´ú£¬Ï ......