LinuxÄں˵Äͬ²½»úÖÆ
¡¡±¾ÎÄÖÜÏêµÄ½éÉÜÁËLinuxÄÚºËÖеÄͬ²½»úÖÆ£ºÔ×Ó²Ù×÷¡¢ÐźÅÁ¿¡¢¶ÁдÐźÅÁ¿ºÍ×ÔÐýËøµÄAPI£¬Ê¹ÓÃÐèÇó¼°Ò»Ð©µäÐÍʾÀý
¡¡¡¡Ò»¡¢ÒýÑÔ
¡¡¡¡ÔÚÏÖ´ú²Ù×÷ϵͳÀͬһʱ¼ä¿ÉÄÜÓжà¸öÄÚºËÖ´ÐÐÁ÷ÔÚÖ´ÐУ¬Òò´ËÄÚºËÆäʵÏó¶à½ø³Ì¶àÏ̱߳à³ÌÏàͬҲÐèҪһЩͬ²½»úÖÆÀ´Í¬²½¸÷Ö´Ðе¥Ôª¶Ô¹²ÏíÊý¾ÝµÄ·ÃÎÊ¡£ÓÈÆäÊÇÔڶദÀíÆ÷ϵͳÉÏ£¬¸üÐèҪһЩͬ²½»úÖÆÀ´Í¬²½²»Í¬´¦ÀíÆ÷ÉϵÄÖ´Ðе¥Ôª¶Ô¹²ÏíµÄÊý¾ÝµÄ·ÃÎÊ¡£
¡¡
¡¡ÔÚÖ÷Á÷µÄLinuxÄÚºËÖаüº¬Á˼¸ºõËùÓÐÏÖ´úµÄ²Ù×÷ϵͳ¾ßÓеÄͬ²½»úÖÆ£¬ÕâЩͬ²½»úÖÆ°üÀ¨£ºÔ×Ó²Ù×÷¡¢ÐźÅÁ¿£¨semaphore£©¡¢¶ÁдÐźÅÁ¿
£¨rw_semaphore£©¡¢spinlock¡¢BKL(Big Kernel
Lock)¡¢rwlock¡¢brlock£¨Ö»°üº¬ÔÚ2.4ÄÚºËÖУ©¡¢RCU£¨Ö»°üº¬ÔÚ2.6ÄÚºËÖУ©ºÍseqlock£¨Ö»°üº¬ÔÚ2.6ÄÚºËÖУ©¡£
¡¡¡¡¶þ¡¢Ô×Ó²Ù×÷
¡¡¡¡ËùνÔ×Ó²Ù×÷£¬¾ÍÊǸòÙ×÷¾ø²»»áÔÚÖ´ÐÐÍê±ÏÇ°±»ËùÓÐÆäËûÈÎÎñ»òʼþ´ò¶Ï£¬Ò²¾Í˵£¬ËûµÄ×îСµÄÖ´Ðе¥Î»£¬²»¿ÉÄÜÓбÈËû¸üСµÄÖ´Ðе¥Î»£¬Òò´ËÕâÀïµÄÔ×Óʵ¼ÊÊÇʹÓÃÁËÎïÀíѧÀïµÄÎïÖÊ΢Á£µÄ¸ÅÄî¡£
¡¡¡¡Ô×Ó²Ù×÷ÐèÒªÓ²¼þµÄÖ§³Ö£¬Òò´ËÊǼܹ¹Ïà¹ØµÄ£¬ÆäAPIºÍÔ×ÓÀàÐ͵Ķ¨Ò嶼¶¨ÒåÔÚÄÚºËÔ´ÂëÊ÷µÄinclude/asm/atomic.hÎļþÖУ¬ËûÃǶ¼Ê¹Óûã±àÓïÑÔʵÏÖ£¬ÒòΪCÓïÑÔ²¢²»ÄÜʵÏÖÕâÑùµÄ²Ù×÷¡£
¡¡¡¡Ô×Ó²Ù×÷Ö÷ÒªÓÃÓÚʵÏÖ×ÊÔ´¼ÆÊý£¬·Ç³£¶àÒýÓüÆÊý(refcnt)¾ÍÊÇͨ¹ýÔ×Ó²Ù×÷ʵÏֵġ£Ô×ÓÀàÐͶ¨ÒåÈçÏ£º
typedef struct
{
volatile int counter;
}
atomic_t;
¡¡¡¡volatileÐÞÊÎ×ֶθæËßgcc²»Òª¶Ô¸ÃÀàÐ͵ÄÊý¾Ý×öÓÅ»¯´¦Àí£¬¶ÔËûµÄ·ÃÎʶ¼ÊǶÔÄÚ´æµÄ·ÃÎÊ£¬¶ø²»ÊǶԼĴæÆ÷µÄ·ÃÎÊ¡£
¡¡¡¡Ô×Ó²Ù×÷API°üÀ¨£º
atomic_read(atomic_t * v);
¡¡¡¡¸Ãº¯Êý¶ÔÔ×ÓÀàÐ͵ıäÁ¿½øÐÐÔ×Ó¶Á²Ù×÷£¬Ëû·µ»ØÔ×ÓÀàÐ͵ıäÁ¿vµÄÖµ¡£
atomic_set(atomic_t * v, int i);
¡¡¡¡¸Ãº¯ÊýÉèÖÃÔ×ÓÀàÐ͵ıäÁ¿vµÄֵΪi¡£
void atomic_add(int i, atomic_t *v);
¡¡¡¡¸Ãº¯Êý¸øÔ×ÓÀàÐ͵ıäÁ¿vÔö¼ÓÖµi¡£
atomic_sub(int i, atomic_t *v);
¡¡¡¡¸Ãº¯Êý´ÓÔ×ÓÀàÐ͵ıäÁ¿vÖмõÈ¥i¡£
int atomic_sub_and_test(int i, atomic_t *v);
¡¡¡¡¸Ãº¯Êý´ÓÔ×ÓÀàÐ͵ıäÁ¿vÖмõÈ¥i£¬²¢ÅжϽá¹ûÊÇ·ñΪ0£¬Èç¹ûΪ0£¬·µ»ØÕ棬·ñÔò·µ»Ø¼Ù¡£
void atomic_inc(atomic_t *v);
¡¡¡¡¸Ãº¯Êý¶ÔÔ×ÓÀàÐͱäÁ¿vÔ×ÓµØÔö¼Ó1¡£
void atomic_dec(atomic_t *v);
¡¡¡¡¸Ãº¯Êý¶ÔÔ×ÓÀàÐ͵ıäÁ¿vÔ×ӵؼõ1¡£
int atomic_dec_and_test(atomic_t *v);
¡¡¡¡¸Ãº¯Êý¶ÔÔ×ÓÀàÐ͵ıäÁ¿vÔ×ӵؼõ1£¬²¢Åж
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
ÔÎÄÍøÖ·£ºhttp://group.ednchina.com/1036/21283.aspx
RCU»úÖÆÊÇLinux2.6Ö®ºóÌṩµÄÒ»ÖÖÊý¾ÝÒ»ÖÂÐÔ·ÃÎʵĻúÖÆ£¬´ÓRCU£¨read-copy-update£©µÄÃû³ÆÉÏ¿´£¬ÎÒÃǾÍÄܶÔËûµÄʵÏÖ»úÖÆÓÐÒ»¸ö´ó¸ÅµÄÁ˽⣬ÔÚÐÞ¸ÄÊý¾ÝµÄʱºò£¬Ê×ÏÈÐèÒª¶ÁÈ¡Êý¾Ý£¬È»ºóÉú³ÉÒ»¸ö¸±±¾£¬¶Ô¸±±¾½øÐÐÐ޸ģ¬ÐÞ¸ÄÍê³ÉÖ®ºóÔÙ½«ÀÏÊý¾Ýupdate³ÉеÄÊý¾Ý£¬´ ......
Chapter 1: Thread
¢Ù thread functions
1. pthread_self();
2. thread existing
you can get the value of rval_ptr just by pthread_join(pthread_t tht, void ** rval_ptr)
cancel a thread as the thread exits with PTHREAD_CANCELED in pthread_exit, this functio ......
http://andrew913.javaeye.com/blog/431259
Àí½âLinuxµ÷ÓŲÎÊý
ÔÚÎÒÃǽéÉÜLinuxϵͳµÄ¸÷ÖÖµ÷ÓŲÎÊýºÍÐÔÄܼà²â¹¤¾ß֮ǰ£¬ÐèÒªÏÈÌÖÂÛһЩ¹ØÓÚÐÔÄܵ÷ÓŵIJÎÊý¡£ÒòΪLinuxÊÇÒ»¸ö¿ªÔ´²Ù×÷ϵͳ£¬ËùÒÔÓÖ´óÁ¿¿ÉÓõÄÐÔÄܼà²â¹¤¾ß¡£¶ÔÕâЩ¹¤¾ßµÄÑ¡ÔñÈ¡¾öÓÚÄãµÄ¸öÈËϲºÃºÍ¶ÔÊý¾Ýϸ½ÚµÄÒªÇó¡£ËùÓеÄÐÔÄܼà²â¹¤¾ß¶¼ÊÇ°´ÕÕͬÑùµÄ¹æÔòÀ´ ......