Linux Kernel API (2.6)
#protect share data
spin_lock/spin_unlock: protect the data during process context(and only at process context), and make sure your code bewteen lock/unlock is fast enough.There may deadlock if the same spin_lock is called at interrupt context.
spin_lock_irq/spin_unlock_irq: call it during interrupt context, make sure the irq is on before calling this function, it will disable irq before accessing share data
spin_lock_irqsave/irqrestore: use at interrupt context, and will save/restort irq registers
The code between spin_lock**/spin_unlock** must not sleep.
The spin_lock** API is defined at include/linux/spinlock_api_up.h for UP architecture.
linux/kernel/spinlock.c is only for SMP.
mutex_lock/mutex_unlock: the similar with down/up, but more efficient
mutex_lock_interruptible: the simlilar with down_interruptiable, can be interruptiable by signal.(like CTRL-C)
the code beween mutex_lock and mutex_unlock can go to sleep
Ïà¹ØÎĵµ£º
×î½üÐèÒªÅäÖÃsvn·þÎñÆ÷¡£ÔÚÍøÉÏÕÒÁËһϣ¬Ñ¡ÔñApache£¬SubversionºÍTrac¡£
Ê×ÏÈ×¼±¸ÏµÍ³¹âÅÌ¡£ÒòΪÊÇLinux²Ù×÷ϵͳ£¬ËùÒÔ×¼±¸ºÃϵͳÄܽÚʡһЩʱ¼ä£¬±ÈÈçpython-devel¡£µ«ÊÇhttpd£¬subversionºÍtrac»¹ÊÇÏÂÔØÔ´Âë±àÒë°É¡£
ÏÂÔØÈí¼þ°ü£º
Gen ......
LinuxÎļþÃûµÄ³¤¶ÈÏÞÖÆÊÇ255¸ö×Ö·û
windowsÏÂÍêÈ«ÏÞ¶¨ÎļþÃû±ØÐëÉÙÓÚ260¸ö×Ö·û£¬Ä¿Â¼Ãû±ØÐëСÓÚ248¸ö×Ö·û¡£
linuxÏÂÎļþÊý¡¢Ä¿Â¼Êý¡¢ÎļþÃû³¤¶ÈµÄ¸÷ÖÖÏÞÖÆ
ÒÔϲâÊÔ¶¼ÊÇÔÚûÓÐÓÅ»¯»òÐÞ¸ÄÄں˵ÄǰÌáϲâÊԵĽá¹û
1. ²âÊÔÄ¿µÄ£ºext3ÎļþϵͳÏÂfilename×î´ó×Ö·û³¤¶È
²âÊÔÆ½Ì¨£ºRHEL5U3_x64
²âÊÔ¹ý³Ì£º
L ......
ÔÚlinuxÏ£¬¹À¼ÆÄã¾³£Ê¹ÓÃpwdÕâ¸öÃüÁÕâ¸öÃüÁî¾ÍÊÇ´òÓ¡µ±Ç°µÄ¹¤×÷·¾¶£¬¼´print working directroy, ½ñÌìÎÒÃÇÒ²À´cÓïÑÔʵÏÖÕâ¸öÃüÁî¡£
ҪʵÏÖÕâ¸ö¹¦ÄÜ£¬ÐèÒªÓõ½ÏÂÃæµÄÒ»¸öϵͳµ÷Óãº
#include <unistd.h>
char *getcwd(char *buf, size_t size);
¸Ãϵͳµ÷Ó÷µ»Øµ±Ç°µÄ¹¤×÷Ŀ¼µÄ¾ø¶Ô·¾¶£¬¾ø¶Ô·¾¶ ......
ʵÑé2 LinuxÎļþϵͳ
Ò».ʵÑéÄ¿µÄ
ͨ¹ýʵÑéÕÆÎÕLinuxÖÐÎļþ¹ÜÀíµÄ»ù±¾¸ÅÄ°üÀ¨³£ÓÃÃüÁî¸ñʽ¡¢ÎļþÀàÐÍ¡¢Ä¿Â¼½á¹¹µÈ£¬³õ²½Á˽âÓйØÎļþ°²È«·½ÃæµÄ֪ʶ¡£¡£
¶þ.ʵÑéÄÚÈÝ
1.ʹÓÃpwd£¬cd£¬lsµÈÃüÁîä¯ÀÀÎļþϵͳ¡£
2.ʹÓÃcat£¬cp£¬mv£¬head£¬tail£¬rmµÈÃüÁî²é¿´ºÍ²Ù×÷Îļþ¡£
3.ʹÓÃfind£¬grepÃüÁî½øÐÐÎļþ²éÕÒºÍ ......
ÕªÒª
ÎÒÃÇÔÚÕâÀïÌÖÂÛµÄÊǶÔǶÈëʽlinuxϵͳµÄÆô¶¯¹ý³ÌµÄÊä³öÐÅÏ¢µÄ×¢ÊÍ£¬Í¨¹ýÎÒÃǵÄÌÖÂÛ£¬´ó¼Ò»á¶ÔǶÈëʽlinuxÆô¶¯¹ý³ÌÖгöÏֵġ¢ÒÔǰ¸Ð¾õÊìϤµÄ¡¢µ«È´ÓÖËÆÊǶø·ÇµÄ¶«Î÷ÓÐÒ»¸öÈ·ÇеÄÁ˽⣬²¢ÇÒÄÜÁ˽⵽ÕâЩÊä³öÐÅÏ¢µÄÀ´ÁúÈ¥Âö¡£
ǶÈëʽlinuxµÄÆô¶¯ÐÅÏ¢ÊÇÒ»¸öºÜÖµµÃÎÒÃÇÈ¥ºÃºÃÑо¿µÄ¶«Î÷£¬ËüÄܽ«Ò»·ùËõӰͼ³ÊÏÖÔÚÎÒÃÇÃæÇ°£ ......