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
Ïà¹ØÎĵµ£º
ÖÁ´ËÂä±ÊÖ®¼Ê£¬Ç¡ÖÁLinuxÎÊÊÀ18ÖÜÄ꣬18ÄêµÄ³É³¤£¬ÈçÃÎËÆ»Ã£¬·çÓêÆÄ¶à£¬¸Ð¿®ÆÄ¶à¡£
ÓÌ×ÔÒäÆð¶àÄêÒÔǰһλǰ±²Ñµµ¼Ê±µÄóðÑÔ£º½ñÌìµÄ±ØÈ»ÕýÊÇÓÉ֮ǰһϵÁеÄżȻËù¾ö¶¨µÄ¡£¹ýÈ¥µÄijÄêijÔ£¬ÎÒżȻ³õʶLinux¾ÍÉíÏÝÆäÖУ¬ÖÁ½ñÈÔÕÒ²»µ½³öÈ¥µÄ·£¬¶øÕýÊÇÕâ´ÎÄËÖÁÖ®ºóµÄ¶à´ÎżȻÏàÁªºÏ£¬´Ó¶ø¾ö¶¨Á˽ñÈÕµÄÎÒÒªÔÚ´ËдÏÂÕâЩ»°¡£ÄÇô ......
È«ÎÄÃèÊöÁË´Ówindowx xpϵͳÖУ¬Í¨¹ýÓ²ÅÌÖдæÔÚµÄubuntuµÄiso°²×°Îļþ£¬ Òýµ¼ÏµÍ³Íê³ÉLinuxµÄ°²×°¡£
ÔÀí£º ÉèÖÃϵͳµÄÆô¶¯·½Ê½£¬Í¨¹ýÐÞ¸Äboot.iniÎļþ£¬ÀûÓÃgrub for dos Òýµ¼ÏµÍ³´ÓisoÆô¶¯£¬´Ó¶øË³ÀûÆô¶¯UbuntuµÄ°²×°¡£
(×¢Ò⣺Ubuntu isoÎļþ¿ÉÒÔ²»Óð²×°£¬Ö±½ÓʹÓá£Ï൱ÓÚLive CDÒ»Ñù£¬ Ö»ÊÇ´¦ÀíµÄ½á¹û² ......
×î½üÔÚÑо¿ Linux Äں˵Äʱ¼ä×Óϵͳ£¬ÎªÏÂһƪ³¤ÎÄ¡¶·þÎñÆ÷³ÌÐòÖеÄÈÕÆÚÓëʱ¼ä¡·×ö×¼±¸£¬ÎÞÒâÖÐ×¢Òâµ½ÁË Linux ÐÂÔöµÄ¼¸¸öϵͳµ÷ÓõĶԱàд·þÎñÆ÷´úÂëµÄÓ°Ï죬ÏÈ´óּǼÔÚÕâÀï¡£ÕâÆª²©¿ÍÒ²¿ÉËã×÷ǰһƪ¡¶¶àÏ̷߳þÎñÆ÷µÄ³£Óñà³ÌÄ£ÐÍ¡·µÄÒ»¸ö×¢½Å¡£ 1. ·þÎñÆ÷³ÌÐòµÄ·ç¸ñ¿ÉÄÜÔÚ±ä еĴ´½¨ÎļþÃèÊö·ûµÄ syscall Ò»°ã¶¼Ö§³Ö ......
ʵÑé2 LinuxÎļþϵͳ
Ò».ʵÑéÄ¿µÄ
ͨ¹ýʵÑéÕÆÎÕLinuxÖÐÎļþ¹ÜÀíµÄ»ù±¾¸ÅÄ°üÀ¨³£ÓÃÃüÁî¸ñʽ¡¢ÎļþÀàÐÍ¡¢Ä¿Â¼½á¹¹µÈ£¬³õ²½Á˽âÓйØÎļþ°²È«·½ÃæµÄ֪ʶ¡£¡£
¶þ.ʵÑéÄÚÈÝ
1.ʹÓÃpwd£¬cd£¬lsµÈÃüÁîä¯ÀÀÎļþϵͳ¡£
2.ʹÓÃcat£¬cp£¬mv£¬head£¬tail£¬rmµÈÃüÁî²é¿´ºÍ²Ù×÷Îļþ¡£
3.ʹÓÃfind£¬grepÃüÁî½øÐÐÎļþ²éÕÒºÍ ......
ÕªÒª
ÎÒÃÇÔÚÕâÀïÌÖÂÛµÄÊǶÔǶÈëʽlinuxϵͳµÄÆô¶¯¹ý³ÌµÄÊä³öÐÅÏ¢µÄ×¢ÊÍ£¬Í¨¹ýÎÒÃǵÄÌÖÂÛ£¬´ó¼Ò»á¶ÔǶÈëʽlinuxÆô¶¯¹ý³ÌÖгöÏֵġ¢ÒÔǰ¸Ð¾õÊìϤµÄ¡¢µ«È´ÓÖËÆÊǶø·ÇµÄ¶«Î÷ÓÐÒ»¸öÈ·ÇеÄÁ˽⣬²¢ÇÒÄÜÁ˽⵽ÕâЩÊä³öÐÅÏ¢µÄÀ´ÁúÈ¥Âö¡£
ǶÈëʽlinuxµÄÆô¶¯ÐÅÏ¢ÊÇÒ»¸öºÜÖµµÃÎÒÃÇÈ¥ºÃºÃÑо¿µÄ¶«Î÷£¬ËüÄܽ«Ò»·ùËõӰͼ³ÊÏÖÔÚÎÒÃÇÃæÇ°£ ......