Linux C notes (BOOK UNIX)
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 function only send a signal but not wait until the thread really exits
We can give a function to a thread with which the thread can invoke it when it exits. This
pthread_clean_push
These two functions must be in pairs in your function routines but not in the main function. And one thing should be mentioned as : the routine should not be returned but
pthread_detach(pthread_t tid)
4. Thread synchronization of thread
¢Ú thread. synchronics
pthread_mutex_t variable
pthread_mutex_destroy()
ii. Lock
pthread_mutex_trylock() return instantly
pthread_unlock()
pthread_rwlook_t
pthread_rwlock_init
pthread_rwlock_destroy
ii. Lock
pthread_rwlock_wrlook
pthread_rwlock_unlock
pthread_rwlock_tryrdlock
pthread_rwlock_trywrlock
3. Cond
i. initiation
pthread_cond_init(&pcndt, attr);
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
1. LinusºÍBill
ËÆºõÔÚÒ»Ò¹Ö®¼ä£¬Õâ¸öÃû×ÖͻȻ±äµÃͬÏó±È¶û¡£¸Ç´ÄÒ»ÑùµÄ¶úÊìÄÜÏê¡£µ«ÊDZȶû¡£¸Ç´Ä£¬
ÄÄÅÂÉí¼ÛÓÐÊý²»Çå±¶µÄ°ÙÍòÃÀ½ð£¬Ò²ÓÀÔ¶²»»á±ä³ÉLinux Torvalds¡£Õâλ29ËêµÄ·ÒÀ¼ÈË£¬
¼òµ¥¶øÇ¿´óµÄLinux²Ù×÷ϵͳµÄ´´ÔìÕߣ¬³¬Ô½Á˸ǴĵÄÉñ»°¡£Ò²Óд«ÎÅ˵¸Ç´ÄÊÇÒ»¸ö
׿ԽµÄ³ÌÐòÔ±£¬µ«LinusÊÇ»õÕæ¼ÛʵµÄ¸ßÊÖ¡£»¹ÔÚ´óѧÀï ......
ÔÎÄÍøÖ·£ºhttp://group.ednchina.com/1036/21283.aspx
RCU»úÖÆÊÇLinux2.6Ö®ºóÌṩµÄÒ»ÖÖÊý¾ÝÒ»ÖÂÐÔ·ÃÎʵĻúÖÆ£¬´ÓRCU£¨read-copy-update£©µÄÃû³ÆÉÏ¿´£¬ÎÒÃǾÍÄܶÔËûµÄʵÏÖ»úÖÆÓÐÒ»¸ö´ó¸ÅµÄÁ˽⣬ÔÚÐÞ¸ÄÊý¾ÝµÄʱºò£¬Ê×ÏÈÐèÒª¶ÁÈ¡Êý¾Ý£¬È»ºóÉú³ÉÒ»¸ö¸±±¾£¬¶Ô¸±±¾½øÐÐÐ޸ģ¬ÐÞ¸ÄÍê³ÉÖ®ºóÔÙ½«ÀÏÊý¾Ýupdate³ÉеÄÊý¾Ý£¬´ ......
ÔÎÄÍøÖ·£ºhttp://blog.chinaunix.net/u1/51562/showart_1341707.html
Ò»:ǰÑÔ
RCU»úÖÆ³öÏֵıȽÏÔç,Ö»ÊÇÔÚlinux kernelÖÐÒ»Ö±µ½2.5°æ±¾µÄʱºò²Å±»²ÉÓÃ.¹ØÓÚRCU»úÖÆ,ÕâÀï¾Í²»×ö¹ý¶àµÄ½éÉÜÁË,ÍøÉÏÓкܶàÓйØRCU½éÉܺÍʹÓõÄÎĵµ.Çë×ÔÐвéÔÄ.±¾ÎÄÖ÷ÒªÊÇ´Ólinux kernelÔ´´úÂëµÄ½Ç¶È.À´·ÖÎöRCUµÄʵÏÖ.
ÔÚÌÖÂÛRCUµÄʵ ......
Ò». ÎļþÒ»´Î¶ÁÈëËÙ¶È
linux϶ÁÎļþÕâ¶«Î÷×îºó¶¼ÊÇҪͨ¹ýϵͳµ÷ÓÃsys_read(fd,buf,count)À´ÊµÏֵģ¬ËùÒÔÈç¹ûÒªÌá¸ßËÙ¶È£¬¾ÍÊÇ×î¼òµ¥µØµ÷ÓÃsys_readµÄ·â×°£¬±ÈÈçÖ±½ÓÓÃread()»òfread()¡£ÏÂÃæÊÇÎÒÔÚlinuxÏµļ¸¸ö²âÊÔ¡£
Ê×ÏÈ´´½¨Ò»¸ö130MÊý¾ÝÎļþ dd if=/dev/zero of=data bs=1024k count=130
[dd if=/dev/zero of=data b ......