LinuxÄÚºËͬ²½£¬½ø³Ì£¬Ïß³Ìͬ²½
°üÀ¨ÎÒ×Ô¼ºÔÚÄÚ£¬ºÜ¶àÈ˶ÔÄںˣ¬½ø³Ì£¬Ïß³Ìͬ²½¶¼²»ÊǺÜÇå³þ£¬ÏÂÃæÉÔ΢×ܽáһϣº
ÄÚºËͬ²½£º
Ö÷ÒªÊÇ·ÀÖ¹¶àºË´¦ÀíÆ÷ͬʱ·ÃÎÊÐÞ¸Äij¶Î´úÂ룬»òÕßÔÚ¶ÔÉ豸Çý¶¯³ÌÐò½øÐÐÁÙ½çÇø±£»¤¡£Ö÷ÒªÓÐһϼ¸ÖÖ·½Ê½£º
1. Mutex£¨»¥³â£©
Í·Îļþ£º
#include <linux/mutex.h>
³õʼ»¯·½·¨£º
DEFINE_MUTEX(name);»òÕß
void mutex_init(struct mutex *lock);
ʹÓ÷½·¨£º
void mutex_lock (struct mutex *lock);
Tries to lock the mutex, sleeps otherwise.
Caution: can't be interrupted, resulting in processes you cannot kill!
int mutex_lock_interruptible (struct mutex *lock);
Same, but can be interrupted. If interrupted, returns a non zero value and doesn't hold the lock. Test the return value!!!
int mutex_trylock (struct mutex *lock);
Never waits. Returns a non zero value if the mutex is not available.int mutex_is_locked(struct mutex *lock);Just tells whether the mutex is locked or not.
void mutex_unlock (struct mutex *lock);
Releases the lock. Make sure you do it as quickly as possible!
2. Reader/writer semphopres ¶ÁдÐźÅÁ¿
Allow shared access by unlimited readers, or by only 1 writer. Writers get priority.
ÔÊÐíÓÐÏÞÊýÁ¿µÄ¶Á·ÃÎÊ£¬µ«ÊÇÖ»ÄÜÓÐÒ»¸öд·ÃÎÊ¡£
void init_rwsem (struct rw_semaphore *sem);
void down_read (struct rw_semaphore *sem);
int down_read_trylock (struct rw_semaphore *sem);
int up_read (struct rw_semaphore *sem);
void down_write (struct rw_semaphore *sem);
Ïà¹ØÎĵµ£º
linuxĿ¼¼Ü¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî binary file µÄÄ¿錄
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ (kernel) ÔÚÄÚ
/boot/grub/menu.lst GRUBÉèÖÃ
/boot/vmlinuz ÄÚºË
&nbs ......
from:×ÞöεÄרÀ¸
ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
&n ......
Ò»¡¢ÒýÑÔ
ÔÚÏÖ´ú²Ù×÷ϵͳÀͬһʱ¼ä¿ÉÄÜÓжà¸öÄÚºËÖ´ÐÐÁ÷ÔÚÖ´ÐУ¬Òò´ËÄÚºËÆäʵÏó¶à½ø³Ì¶àÏ̱߳à³ÌÒ»ÑùÒ²ÐèҪһЩͬ²½»úÖÆÀ´Í¬²½¸÷Ö´Ðе¥Ôª¶Ô¹²ÏíÊý¾ÝµÄ·ÃÎÊ¡£ÓÈÆäÊÇÔڶദÀíÆ÷ϵͳÉÏ£¬¸üÐèҪһЩͬ²½»úÖÆÀ´Í¬²½²»Í¬´¦ÀíÆ÷ÉϵÄÖ´Ðе¥Ôª¶Ô¹²ÏíµÄÊý¾ÝµÄ·ÃÎÊ¡£
ÔÚÖ÷Á÷µÄLinuxÄÚºËÖаüº¬Á˼¸ºõËùÓÐÏÖ´úµÄ²Ù×÷ϵͳ¾ßÓеÄͬ²½» ......
µÚ2Õ Linux°²×°Á˽âÁËLinuxµÄÀúÊ·ºÍ·¢Õ¹¹ý³Ì£¬¶ÁÕß´ó¸ÅÒѾ¼±ÇеØÏëÒª°ÑLinux°²×°µ½×Ô¼ºµÄ¼ÆËã»úÉÏ¡£ÎÞËùη¾åµÄ¶ÁÕß¿ÉÄÜÒѾÔÚÔĶÁ±¾ÕÂ֮ǰ¾Í×ö¹ýÕâÑùµÄ³¢ÊÔ¡£ÎÞÂÛÕâЩ³¢ÊÔ×îÖÕÊdzɹ¦»¹ÊÇʧ°Ü£¬¾Í´ÓÕâÀ↑ʼLinuxÖ®Âðɣ¡ ......
2.2 °²×°LinuxÖÁÓ²ÅÌ
×¼±¸¹¤×÷Íê³ÉÖ®ºó£¬¾Í¿ÉÒÔ×ÅÊÖ½«Linux°²×°µ½Ó²ÅÌÖÐÁË¡£Èç½ñLinuxµÄ°²×°¹ý³ÌÒѾ·Ç³£“ɵ¹Ï”»¯£¬Ö»ÐèÒªÇáµã¼¸ÏÂÊó±ê£¬¾ÍÄܹ»Íê³ÉÕû¸öϵͳµÄ°²×°¡£¾¡¹ÜÈç´Ë£¬ÕâÀïÈÔÈ»ÏêϸµØ¸ø³ö°²×°¹ý³ÌµÄÿһ²½¡£Í¬Ê±£¬¶ÔÓÚºÍWindows´æÔÚÏÔÖøÇø±ðµÄµØ·½£¬ÈçÓ²ÅÌ·ÖÇøµÄ×éÖ¯·½Ê½£¬±¾½Ú½«×öÏêϸµÄÌÖÂÛ¡£ ......