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);
Ïà¹ØÎĵµ£º
Linux LVM µÄʹÓÃÏê½â
http://blog.csdn.net/icejadelove/archive/2009/10/30/4747657.aspx
ÕªÒª£ºLinuxÓû§°²×°Linux²Ù×÷ϵͳʱÓöµ½µÄÒ»¸ö×î³£¼ûµÄÄÑÒÔ¾ö¶¨µÄÎÊÌâ¾ÍÊÇÈçºÎÕýÈ·µØ¸øÆÀ¹À¸÷·ÖÇø´óС£¬ÒÔ·ÖÅäºÏÊʵÄÓ²Å̿ռ䡣¶øÓöµ½³öÏÖij¸ö·ÖÇø¿Õ¼äºÄ¾¡Ê±£¬½â¾öµÄ·½·¨Í¨³£ÊÇʹÓ÷ûºÅÁ´½Ó£¬»òÕßʹÓõ÷Õû·ÖÇø´óСµÄ¹¤¾ß(±ÈÈçP ......
ÔÎÄÍøÖ·£º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 ......