Linux µÄ¶àÏ̱߳à³ÌµÄ¸ßЧ¿ª·¢¾Ñé
2009 Äê 4 ÔÂ 23 ÈÕ
±¾ÎÄÖÐÎÒÃÇÕë¶Ô Linux É϶àÏ̱߳à³ÌµÄÖ÷ÒªÌØÐÔ×ܽá³ö 5 Ìõ¾Ñ飬ÓÃÒÔ¸ÄÉÆ Linux ¶àÏ̱߳à³ÌµÄÏ°¹ßºÍ±ÜÃâÆäÖеĿª·¢ÏÝÚå¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇ´©²åһЩ Windows µÄ±à³ÌÓÃÀýÓÃÒÔ¶Ô±È Linux ÌØÐÔ£¬ÒÔ¼ÓÉî¶ÁÕßÓ¡Ïó¡£
±³¾°
Linux ƽ̨ÉϵĶàÏ̳߳ÌÐò¿ª·¢Ïà¶ÔÓ¦ÆäËûƽ̨£¨±ÈÈç Windows£©µÄ¶àÏß³Ì API ÓÐһЩϸ΢ºÍÒþ»ÞµÄ²î±ð¡£²»×¢ÒâÕâЩ Linux ÉϵÄһЩ¿ª·¢ÏÝÚ壬³£³£»áµ¼Ö³ÌÐòÎÊÌâ²»ÇËÀËø²»¶Ï¡£±¾ÎÄÖÐÎÒÃÇ´Ó 5 ¸ö·½Ãæ×ܽá³ö Linux ¶àÏ̱߳à³ÌÉϵÄÎÊÌ⣬²¢·Ö±ðÒý³öÏà¹Ø¸ÄÉƵĿª·¢¾Ñ飬ÓÃÒÔ±ÜÃâÕâЩµÄÏÝÚå¡£ÎÒÃÇÏ£ÍûÕâЩ¾Ñé¿ÉÒÔ°ïÖú¶ÁÕßÃÇÄܸüºÃ¸ü¿ìµÄÊìϤ Linux ƽ̨µÄ¶àÏ̱߳à³Ì¡£
ÎÒÃǼÙÉè¶ÁÕ߶¼ÒѾºÜÊìϤ Linux ƽ̨ÉÏ»ù±¾µÄÏ̱߳à³ÌµÄ Pthread ¿â API ¡£ÆäËûµÄµÚÈý·½ÓÃÒÔÏ̱߳à³ÌµÄ¿â£¬Èç boost£¬½«²»»áÔÚ±¾ÎÄÖÐÌá¼°¡£±¾ÎÄÖÐÖ÷ÒªÉæ¼°µÄÌâ²Ä°üÀ¨Ï߳̿ª·¢ÖеÄÏ̹߳ÜÀí£¬»¥³â±äÁ¿£¬Ìõ¼þ±äÁ¿µÈ¡£½ø³Ì¸ÅÄ²»»áÔÚ±¾ÎÄÖÐÉæ¼°¡£
»ØÒ³Ê×
Linux ÉÏÏ߳̿ª·¢ API µÄ¸ÅÒª½éÉÜ
¶àÏ߳̿ª·¢ÔÚ Linux ƽ̨ÉÏÒѾÓгÉÊìµÄ Pthread ¿âÖ§³Ö¡£ÆäÉæ¼°µÄ¶àÏ߳̿ª·¢µÄ×î»ù±¾¸ÅÄîÖ÷Òª°üº¬Èýµã£ºỊ̈߳¬»¥³âËø£¬Ìõ¼þ¡£ÆäÖУ¬Ï̲߳Ù×÷ÓÖ·ÖÏ̵߳Ĵ´½¨£¬Í˳ö£¬µÈ´ý 3 ÖÖ¡£»¥³âËøÔò°üÀ¨ 4 ÖÖ²Ù×÷£¬·Ö±ðÊÇ´´½¨£¬Ïú»Ù£¬¼ÓËøºÍ½âËø¡£Ìõ¼þ²Ù×÷ÓÐ 5 ÖÖ²Ù×÷£º´´½¨£¬Ïú»Ù£¬´¥·¢£¬¹ã²¥ºÍµÈ´ý¡£ÆäËûµÄһЩÏß³ÌÀ©Õ¹¸ÅÄÈçÐźŵƵȣ¬¶¼¿ÉÒÔͨ¹ýÉÏÃæµÄÈý¸ö»ù±¾ÔªËصĻù±¾²Ù×÷·â×°³öÀ´¡£
Ị̈߳¬»¥³âËø£¬Ìõ¼þÔÚ Linux ƽ̨É϶ÔÓ¦µÄ API ¿ÉÒÔÓñí 1 ¹éÄÉ¡£ÎªÁË·½±ãÊìϤ Windows Ï̱߳à³ÌµÄ¶ÁÕßÊìϤ Linux ¶àÏ߳̿ª·¢µÄ API£¬ÎÒÃÇÔÚ±íÖÐͬʱҲÁгö Windows SDK ¿âÖÐËù¶ÔÓ¦µÄ API Ãû³Æ¡£
±í 1. Ï̺߳¯ÊýÁбí
¶ÔÏó
²Ù×÷
Linux Pthread API
Windows SDK ¿â¶ÔÓ¦ API
Ïß³Ì
´´½¨
pthread_create
CreateThread
Í˳ö
pthread_exit
ThreadExit
µÈ´ý
pthread_join
WaitForSingleObject
»¥³âËø
´´½¨
pthread_mutex_init
CreateMutex
Ïú»Ù
pthread_mutex_destroy
CloseHandle
¼ÓËø
pthread_mutex_lock
WaitForSingleObject
½âËø
pthread_mutex_unlock
ReleaseMutex
Ìõ¼þ
´´½¨
pthread_cond_init
CreateEvent
Ïú»Ù
pthread_cond_destroy
CloseHandle
´¥·¢
pthread_cond_signal
SetEvent
¹ã²¥
pthread_cond_broadcast
SetEvent / ResetEvent
µÈ´ý
pthread_cond_wait / pthread_cond_timedwait
SingleObjectAndWait
¶àÏ߳̿ª·¢ÔÚ Linux
Ïà¹ØÎĵµ£º
ÕâÊDZ¾ÎĵõÚÈý²¿·Ö,ÔÚÇ°Á½²¿·ÖÖÐ,ÎÒÒѾ½²ÊöÁËLinux²Ù×÷ϵͳÊÇÈçºÎ±»»úÆ÷bootµ½,²¢ÇÒloadµ½Öƶ¨µÄÄÚ´æµØÖ·µÄ.ÎÒÃǽ«¼ÌÐøµÚ¶þ²¿·ÖµÄÄÚ
ÈÝ,¿´¿´²Ù×÷ϵͳÔÚÍê³ÉÁËbootsect.sºÍsetup.sµÄÔËÐкó,ÔÚhead.sÖÐ×öÁËЩʲô.
ÈÃÎÒÃÇ»ØÒäÒ»ÏÂ,ÔÚsetup.sÖÐ,ÎÒÃÇ°ÑÕû¸ösystemÄ£¿é´ÓµØÖ·0x10000³öÍùÏÂÒƶ¯ÁË0x10000µÄ¾àÀë,Ò²¾ÍÊÇ˵,ÏÖ ......
linuxÉ豸Çý¶¯µÄѧϰÊÇÒ»ÏîºÆ´óµÄ¹¤³Ì,¶ÁÕßÐèÒªÊ×ÏÈÕÆÎÕÒÔÏ»ù´¡:
1.Á¼ºÃµÄÓ²¼þ»ù´¡,¶®µÃSRAM,FLASH,SDRAM,Ó²Å̵ĶÁд·½Ê½,UART,I2C,USBµÈÉ豸½Ó ¿Ú,ÂÖѯ,ÖжÏ,DMAµÄÔÀí,PCI×ÜÏߵŤ×÷·½Ê½ÒÔ¼°CPUµÄÄÚ´æ¹ÜÀíµ¥Ôª(MMU)µÈ.
2.Á¼ºÃµÄCÓïÑÔ»ù´¡,ÄÜÁé»îµØÔ ......
1. linuxÏÂÆô¶¯oracle
su - oracle
sqlplus /nolog
conn /as sysdba
startup
exit
lsnrctl start
exit
2. linuxϹرÕoracle
su - oracle
sqlplus /nolog
conn /as sysdba
shutdown immediate
exit
lsnrctl stop
exit
3¡¢Æô¶¯¼àÌýÆ÷
oracle@suse92:~> lsnrctl start
4¡¢Í£Ö¹¼àÌýÆ÷
oracle@suse92:~ ......
·½Ê½Ò»£º
ifconfig eth0 192.168.1.18 netmask 255.255.255.0
˵Ã÷£º¸ÃÖÖ·½Ê½¿ÉÒÔʹ¸Ä±ä¼´Ê±ÉúЧ£¬ÖØÆôºó»á»Ö¸´ÎªÔÀ´µÄIP
·½Ê½¶þ£º
vi /etc/sysconfig/network-scripts/ifcfg-eth0
˵Ã÷£º¸Ã·½Ê½ÒªÖØÆôºóÉúЧ£¬ÇÒÊÇÓÀ¾ÃµÄ
Èç¹ûÒªÁ¢¼´¸ü¸ÄÇÒÓÀ¾ÃÉúЧ£¬¾ÍÖ»ÄÜÒÔÉÏÁ½ÖÖ·½Ê½Í¬Ê±Ê¹ÓÃÁË¡£
ÒÔÉÏÊÇͨ¹ýlinuxÃüÁîÐÐÐÞ¸ÄIPµÄ· ......
Linux²Ù×÷ϵͳÊÇÒ»ÖÖ¶àÓû§¶àÈÎÎñ¡¢Ö§³Ö¶àÖÖƽ̨µÄ¿ªÔ´µÄÀàUnix²Ù×÷ϵͳ£¬ÆäÖ§³Ö¶àÖÖƽ̨£¬ÔÚ·þÎñ¶Ë¿ÉÓëÆäËüÉÌÓÃÀàUnixϵͳæÇÃÀ£¬ÔÚ¿Í»§¶ËÔòÏòWindowsϵÁз¢³öÁËÇ¿ÓÐÁ¦µÄÌôÕ½¡£×ÔLinuxµ®ÉúÒÔÀ´£¬·¢Õ¹Ñ¸ÃÍ£¬ÒѾÊܵ½ÁËÈ«Çò¿ªÔ´ÉçÇøºÍÐí¶àÉÌÒµ¿Æ¼¼¾ÞÍ·µÄ´óÁ¦Ö§³ÖÒÔ¼°Õþ¸®¡¢½ÌÓý»ú¹¹¡¢¿ÆÑе¥Î»µÄÖØÊÓ¡£±¾ÎĽéÉÜÁËLinuxÐéÄâ´æ´¢ ......