¡¾LinuxÓ¦ÓÃÓëÇý¶¯¿ª·¢¡¿LinuxÄں˵ÄÅŶÓ×ÔÐýËø
ÅŶÓ×ÔÐýËø(FIFO Ticket Spinlock)ÊÇ Linux ÄÚºË 2.6.25 °æ±¾ÖÐÒýÈëµÄÒ»ÖÖÐÂÐÍ×ÔÐýËø£¬Ëü½â¾öÁË´«Í³×ÔÐýËøÓÉÓÚÎÞÐò¾ºÕùµ¼Öµē¹«Æ½ÐÔ”ÎÊÌâ¡£±¾ÎÄÏêϸ½éÉÜÁËÅŶÓ×ÔÐýËøµÄÉè¼ÆÔÀíºÍ¾ßÌåʵÏÖ£¬²¢Óë ²Ù×÷ϵͳ²ÉÓõÄÀàËƼ¼Êõ½øÐбȽϡ£×îºóÌÖÂÛ¿ÉÄܵÄÀ©Õ¹ÅŶÓ×ÔÐýËøµÄһЩÏë·¨¡£
ÒýÑÔ
×ÔÐýËø(Spinlock)ÊÇÒ»ÖÖ Linux ÄÚºËÖй㷺ÔËÓõĵײãͬ²½»úÖÆ¡£×ÔÐýËøÊÇÒ»ÖÖ¹¤×÷ÓڶദÀíÆ÷»·¾³µÄÌØÊâµÄËø£¬ÔÚµ¥´¦Àí»·¾³ÖÐ×ÔÐýËøµÄ²Ù×÷±»Ì滻Ϊ¿Õ²Ù×÷¡£µ±Ä³¸ö´¦ÀíÆ÷ÉϵÄÄÚºËÖ´ÐÐÏß³ÌÉêÇë×ÔÐýËøʱ£¬Èç¹ûËø¿ÉÓã¬Ôò»ñµÃËø£¬È»ºóÖ´ÐÐÁÙ½çÇø²Ù×÷£¬×îºóÊÍ·ÅËø£»Èç¹ûËøÒѱ»Õ¼Óã¬Ï̲߳¢²»»áתÈë˯Ãß״̬£¬¶øÊÇæµÈ´ý¸ÃËø£¬Ò»µ©Ëø±»ÊÍ·Å£¬ÔòµÚÒ»¸ö¸ÐÖª´ËÐÅÏ¢µÄÏ߳̽«»ñµÃËø¡£
³¤ÆÚÒÔÀ´£¬ÈËÃÇ×ÜÊǹØ×¢ÓÚ×ÔÐýËøµÄºÍ¸ßЧ£¬¶øºöÊÓÁË×ÔÐýËøµÄ“¹«Æ½”ÐÔ¡£´«Í³µÄ×ÔÐýËø±¾ÖÊÉÏÓÃÒ»¸öÕûÊýÀ´±íʾ£¬ÖµÎª1´ú±íËøδ±»Õ¼Óá£ÕâÖÖÎÞÐò¾ºÕùµÄ±¾ÖÊÌص㵼ÖÂÖ´ÐÐÏß³ÌÎÞ·¨±£Ö¤ºÎʱÄÜÈ¡µ½Ëø£¬Ä³Ð©Ï߳̿ÉÄÜÐèÒªµÈ´ýºÜ³¤Ê±¼ä¡£Ëæ׿ÆËã»ú´¦ÀíÆ÷¸öÊýµÄ²»¶ÏÔö³¤£¬ÕâÖÖ“²»¹«Æ½”ÎÊÌ⽫»áÈÕÒæÑÏÖØ¡£
ÅŶÓ×ÔÐýËø(FIFO Ticket Spinlock)ÊÇ Linux ÄÚºË 2.6.25 °æ±¾ÒýÈëµÄÒ»ÖÖÐÂÐÍ×ÔÐýËø£¬Ëüͨ¹ý±£´æÖ´ÐÐÏß³ÌÉêÇëËøµÄ˳ÐòÐÅÏ¢½â¾öÁË´«Í³×ÔÐýËøµÄ“²»¹«Æ½”ÎÊÌâ¡£ÅŶÓ×ÔÐýËøµÄ´úÂëÓÉ Linux Äں˿ª·¢Õß Nick Piggin ʵÏÖ£¬Ä¿Ç°Ö»Õë¶Ô x86 Ìåϵ½á¹¹(°üÀ¨ IA32 ºÍ x86_64)£¬ÏàÐźܿì¾Í»á±»ÒÆÖ²µ½ÆäËüƽ̨¡£
´«Í³×ÔÐýËøµÄʵÏÖÓë²»×ã
Linux ÄÚºË×ÔÐýËøµÄµ×²ãÊý¾Ý½á¹¹ raw_spinlock_t ¶¨ÒåÈçÏ£º
typedef struct {
unsigned int slock;
} raw_spinlock_t;
slockËäÈ»±»¶¨ÒåΪÎÞ·ûºÅÕûÊý£¬µ«ÊÇʵ¼ÊÉϱ»µ±×÷ÓзûºÅÕûÊýʹÓá£slockֵΪ1´ú±íËøδ±»Õ¼Óã¬ÖµÎª0»ò¸ºÊý´ú±íËø±»Õ¼Óᣳõʼ»¯Ê±slock±»ÖÃΪ1¡£
Ïß³Ìͨ¹ýºê spin_lock ÉêÇë×ÔÐýËø¡£Èç¹û²»¿¼ÂÇÄÚºËÇÀÕ¼£¬Ôò spin_lock µ÷Óà __raw_spin_lock º¯Êý£¬´úÂëÈçÏÂËùʾ£º
static inline void __raw_spin_lock(raw_spinlock_t *lock)
{
asm volatile("\n1:\t"
LOCK_PREFIX " ; decb %0\n\t"
"jns 3f\n"
"2:\t"
"rep;nop\n\t"
"cmpb $0,%0\n\t"
"jle 2b\n\t"
"jmp 1b\n"
"3:\n\t"
: "+m" (lock->
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
VIM+GDB linux c/c++ µÄ±à³ÌÀûÆ÷
http://blog.csdn.net/jackyvan/archive/2010/01/15/5193693.aspx
ÆäʵVIMÒ²ÄܰѱàÒë µ÷ÊÔ¼¯³ÉÔÚÒ»Æð£¬ÏñÊÇÒ»¸öIDEÒ»Ñù¡£
Ê×ÏÈÏÖÔÚVIMµÄÔ´Â룬ÒòΪҪ¼¯³Éµ÷ÊÔ»·¾³µÄ»°ÐèÒªÖØбàÒëVIM²ÅÐУ¬ËùÒÔÎÒÃDz»ÈçÖØа²×°Ò»¸ö¡£
VIMµÄÏÖÔÚµØÖ·£º
http://www.vim.org/sources.php
È»ºóÏ ......
ÒѾij¸ö¶Ë¿ÚºÅ±»Õ¼Óã¬ÈçºÎ¸ù¾Ý¶Ë¿ÚºÅµÃµ½Õ¼ÓÃËüµÄ½ø³ÌµÄIDÄØ
ÓÃlsof
£¬lsofÔÚubuntuϵݲװÃüÁîΪapt-get install lsof
ÈôÒÑÖª¶Ë¿ÚºÅΪ15000£¬Ôò¶ÔÓ¦²éÕÒÃüÁîΪlsof -i | grep 15000
±¾»úÏÔʾ½á¹ûΪ£º
host 3386
trinea 4u IPv4 16907 & ......
±¾ÎÄÏêϸ½éÉÜÁËÒôƵCDµÄ»ù±¾ÖªÊ¶£¬ÒÔ¼°ÈçºÎÔÚLinuxϱàдʵÓõÄCD²¥·ÅÈí¼þ£¬ÄÚÈݺ¸ÇÒô¹ì´¦Àí¡¢²¥·Å¿ØÖƺÍÒôÁ¿µ÷½ÚµÈÖî¶à·½Ãæ¡£
ÔÚÄ¿Ç°µÄ¶àýÌåÓ¦ÓÃÖУ¬CDËù³Ðµ£µÄÖØÒª×÷ÓÃÔçÒÑÎðÓ¹ÖÃÒÉ£¬±¾ÎÄÏêϸ½éÉÜÁËÒôƵCDµÄ»ù±¾ÖªÊ¶£¬ÒÔ¼°ÈçºÎÔÚLinuxϱàдʵÓõÄCD²¥·ÅÈí¼þ£¬ÄÚÈݺ¸ÇÒô¹ì´¦Àí¡¢²¥·Å¿ØÖƺÍÒôÁ¿µ÷½ÚµÈÖî¶à·½Ãæ¡£
񙮵 ......