ʹÓà Linux ϵͳµ÷ÓõÄÄÚºËÃüÁî
2007 Äê 4 ÔÂ 17 ÈÕ
Linux® ϵͳµ÷Óà ——
ÎÒÃÇÿÌì¶¼ÔÚʹÓÃËüÃÇ¡£²»¹ýÄúÇå³þϵͳµ÷ÓÃÊÇÈçºÎÔÚÓû§¿Õ¼äºÍÄÚºËÖ®¼äÖ´ÐеÄÂ𣿱¾ÎĽ«Ì½¾¿ Linux
ϵͳµ÷Óýӿڣ¨SCI£©£¬Ñ§Ï°ÈçºÎÌí¼ÓеÄϵͳµ÷Óã¨ÒÔ¼°ÊµÏÖÕâÖÖ¹¦ÄܵįäËû·½·¨£©£¬²¢½éÉÜÓë SCI ÓйصÄһЩ¹¤¾ß¡£
ϵͳµ÷ÓÃ
¾ÍÊÇÓû§¿Õ¼äÓ¦ÓóÌÐòºÍÄÚºËÌṩµÄ·þÎñÖ®¼äµÄÒ»¸ö½Ó¿Ú¡£ÓÉÓÚ·þÎñÊÇÔÚÄÚºËÖÐÌṩµÄ£¬Òò´ËÎÞ·¨Ö´ÐÐ
Ö±½Óµ÷Óã»Ïà·´£¬Äú±ØÐëʹÓÃÒ»¸ö½ø³ÌÀ´¿çÔ½Óû§¿Õ¼äÓëÄÚºËÖ®¼äµÄ½çÏÞ¡£ÔÚÌØ¶¨¼Ü¹¹ÖÐʵÏִ˹¦Äܵķ½·¨»áÓÐËù²»Í¬¡£Òò´Ë£¬±¾ÎĽ«×ÅÑÛÓÚ×îͨÓõļܹ¹ ——
i386¡£
ÔÚ±¾ÎÄÖУ¬ÎÒ½«Ì½¾¿ Linux SCI£¬ÑÝʾÈçºÎÏò 2.6.20
ÄÚºËÌí¼ÓÒ»¸öϵͳµ÷Óã¬È»ºó´ÓÓû§¿Õ¼äÀ´Ê¹ÓÃÕâ¸öº¯Êý¡£ÎÒÃÇ»¹½«Ñо¿ÔÚ½øÐÐϵͳµ÷Óÿª·¢Ê±·Ç³£ÓÐÓõÄһЩº¯Êý£¬ÒÔ¼°ÏµÍ³µ÷ÓÃµÄÆäËûÑ¡Ôñ¡£×îºó£¬ÎÒÃǽ«½éÉÜ
Óëϵͳµ÷ÓÃÓйصÄһЩ¸¨Öú»úÖÆ£¬±ÈÈçÔÚij¸ö½ø³ÌÖиú×Ùϵͳµ÷ÓõÄʹÓÃÇé¿ö¡£
SCI
Linux ÖÐϵͳµ÷ÓõÄʵÏÖ»á¸ù¾Ý²»Í¬µÄ¼Ü¹¹¶øÓÐËù±ä»¯£¬¶øÇÒ¼´Ê¹ÔÚijÖÖ¸ø¶¨µÄÌå¼Ü¹¹ÉÏÒ²»á²»Í¬¡£ÀýÈ磬ÔçÆÚµÄ x86
´¦ÀíÆ÷ʹÓÃÁËÖжϻúÖÆ´ÓÓû§¿Õ¼äÇ¨ÒÆµ½Äں˿ռäÖУ¬²»¹ýÐ嵀 IA-32 ´¦ÀíÆ÷ÔòÌṩÁËһЩָÁî¶ÔÕâÖÖת»»½øÐÐÓÅ»¯£¨Ê¹Óà sysenter
ºÍ sysexit
Ö¸Á¡£ÓÉÓÚ´æÔÚ´óÁ¿µÄ·½·¨£¬×îÖÕ½á¹ûÒ²·Ç³£¸´ÔÓ£¬Òò´Ë±¾ÎĽ«×ÅÖØÓÚ½Ó¿Úϸ½ÚµÄ±í²ãÌÖÂÛÉÏ¡£¸üÏ꾡µÄÄÚÈÝÇë²Î¿´±¾ÎÄ×îºóµÄ ²Î
¿¼×ÊÁÏ
¡£
Òª¶Ô Linux µÄ SCI ½øÐиĽø£¬Äú²»ÐèÒªÍêÈ«Àí½â SCI
µÄÄÚ²¿ÔÀí£¬Òò´ËÎÒ½«Ê¹ÓÃÒ»¸ö¼òµ¥µÄϵͳµ÷Óýø³Ì£¨Çë²Î¿´Í¼ 1£©¡£Ã¿¸öϵͳµ÷Óö¼ÊÇͨ¹ýÒ»¸öµ¥Ò»µÄÈë¿Úµã¶à·´«ÈëÄںˡ£eax
¼Ä´æÆ÷ÓÃÀ´±êʶӦµ±µ÷ÓõÄij¸öϵͳµ÷Óã¬ÕâÔÚ C
¿âÖÐ×öÁËÖ¸¶¨£¨À´×ÔÓû§¿Õ¼äÓ¦ÓóÌÐòµÄÿ¸öµ÷Óã©¡£µ±¼ÓÔØÁËϵͳµÄ C
¿âµ÷ÓÃË÷ÒýºÍ²ÎÊýʱ£¬¾Í»áµ÷ÓÃÒ»¸öÈí¼þÖжϣ¨0x80 Öжϣ©£¬Ëü½«Ö´ÐÐ system_call
º¯Êý£¨Í¨¹ýÖжϴ¦Àí³ÌÐò£©£¬Õâ¸öº¯Êý»á°´ÕÕ eax ÄÚÈÝÖеıêʶ´¦ÀíËùÓеÄϵͳµ÷Óá£ÔÚ¾¹ý¼¸¸ö¼òµ¥²âÊÔÖ®ºó£¬Ê¹Óà system_call_table
ºÍ eax Öаüº¬µÄË÷ÒýÀ´Ö´ÐÐÕæÕýµÄϵͳµ÷ÓÃÁË¡£´Óϵͳµ÷ÓÃÖзµ»Øºó£¬×îÖÕÖ´ÐÐ syscall_exit
£¬²¢µ÷Óà resume_userspace
·µ»ØÓû§¿Õ¼ä¡£È»ºó¼ÌÐøÔÚ C
¿âÖÐÖ´ÐУ¬Ëü½«·µ»Øµ½Óû§Ó¦ÓóÌÐòÖС£
ͼ 1. ʹÓÃÖжϷ½·¨µÄϵͳµ÷Óõļò»¯Á÷³Ì
SCI µÄºËÐÄÊÇϵͳµ÷Óöà··Ö½â±í¡£Õâ¸ö±íÈçͼ 2 Ëùʾ£¬
Ïà¹ØÎĵµ£º
¹þÏ£±í£¨Hashtable£©ÓÖ³ÆÎª“É¢ÖÔ£¬HashtableÊÇ»á¸ù¾ÝË÷Òý¼üµÄ¹þÏ£³ÌÐò´úÂë×éÖ¯³ÉµÄË÷Òý¼ü£¨Key£©ºÍÖµ£¨Value£©Åä¶ÔµÄ¼¯ºÏ¡£Hashtable ¶ÔÏóÊÇÓɰüº¬¼¯ºÏÖÐÔªËØµÄ¹þϣͰ£¨Bucket£©Ëù×é³ÉµÄ¡£¶øBucketÊÇHashtableÄÚÔªËØµÄÐéÄâ×ÓȺ×飬¿ÉÒÔÈô󲿷ּ¯ºÏÖеÄËÑѰºÍ»ñÈ¡¹¤×÷¸üÈÝÒס¢¸ü¿ìËÙ¡£
¹þÏ£º¯ ......
ÔÚLinux 2.6ÄÚºËÖУ¬devfs±»ÈÏΪÊǹýʱµÄ·½·¨£¬²¢×îÖÕ±»Åׯú£¬udevÈ¡´úÁËËü¡£DevfsµÄÒ»¸öºÜÖØÒªµÄÌØµã¾ÍÊÇ¿ÉÒÔ¶¯Ì¬´´½¨É豸½áµã¡£ÄÇÎÒÃÇÏÖÔÚÈçºÎͨ¹ýudevºÍsysÎļþϵͳ¶¯Ì¬´´½¨É豸½áµãÄØ£¿
ÓÃudevÔÚ/dev/϶¯Ì¬Éú³ÉÉ豸Îļþ£¬ÕâÑùÓû§¾Í²»ÓÃÊÖ¹¤µ÷ÓÃmknodÁË¡£
ÀûÓõÄkernel API£º
&nb ......
ÓÉÓÚÕâЩÎļþ²»ÊÇÆÕͨµÄÎļþ£¬ËùÒÔÎÒÃDz»ÄÜÓÃ
ANSI C
£¨±ê×¼
C
£©µÄ
fopen
¡¢
fclose
µÈÀ´²Ù×÷Îļþ£¬¶øÓ¦¸ÃʹÓÃϵͳÎļþ
I/O
´¦Àíº¯Êý£¨
open
¡¢
read
¡¢
write
¡¢
lseek
ºÍ
close
£©À´´¦ÀíÕâЩÉ豸Îļþ¡£
ioctl
£¨£©»òÐíÊÇ
Linux
ÏÂ×îÅÓÔӵĺ¯Êý£¬Ëü¿ÉÒÔ¿ØÖƸ÷ÖÖÎļþµÄÊôÐÔ£¬ÔÚ
Linux
ÉùÒôÉ豸± ......
ʹÓÃBusyBoxÖÆ×÷linux¸ùÎļþϵͳ£¨CramFS+mdev£©
²Ù×÷ϵͳ£ºUbuntu9.04
Äں˰汾£ºlinux-2.6.24.7
¿ª·¢°å£º²©´´arm2410s
½»²æ±àÒ빤¾ß£ºarm-linux-gcc-4.1.1
BusyBox£ºbusybox-1.11.1
CramFS£ºCramFS-1.1
×¢Ò⣺ÓÉÓÚÒªÖ ......
ÎÊÌâµÄÒý³ö£º
µ±¶ÔͬһÎļþ¾ä±ú£¨ÔÚWindowsÏ£©»òÊÇÎļþÃèÊö·û£¨ÔÚLinuxÏ£©½øÐÐËæ»ú¶Áд²Ù×÷ʱ£¬»á´æÔÚÎļþÖ¸ÕëµÄ¶¨Î»Óë¶Á\дÁ©¸ö²½Ö裬µ«ÓÉÓÚÕâ²»ÊÇÒ»¸öÔ×Ó²Ù×÷£¬¾Í¿ÉÄܲúÉúÈçÏÂÎÊÌ⣺½ø³ÌA¶ÔijÎļþÏȶ¨Î»µ½ f1 ´¦£¬È»ºó±»Öжϣ¬È»ºó½ø³ÌB¶ÔͬһÎļþ¶¨Î»µ½ f2 ´¦£¬È» ......