Linuxϵͳµ÷ÓÃÁбí
±¾ÎÄÁгöÁ˴󲿷ֳ£¼ûµÄLinuxϵͳµ÷Ó㬲¢¸½ÓмòÒªÖÐÎÄ˵Ã÷¡£ ÒÔÏÂÊÇLinuxϵͳµ÷ÓõÄÒ»¸öÁÐ±í£¬°üº¬Á˴󲿷ֳ£ÓÃϵͳµ÷ÓúÍÓÉϵͳµ÷ÓÃÅÉÉú³öµÄµÄº¯Êý¡£Õâ¿ÉÄÜÊÇÄãÔÚ»¥ÁªÍøÉÏËùÄÜ¿´µ½µÄΨһһƪÖÐÎÄ×¢Ê͵ÄLinuxϵͳµ÷ÓÃÁÐ±í£¬¼´Ê¹ÊǼòµ¥µÄ×ÖĸÐòÓ¢ÎÄÁÐ±í£¬ÄÜ×öµ½ÕâôÍêÈ«Ò²ÊǺܺ±¼ûµÄ¡£ °´ÕÕ¹ßÀý£¬Õâ¸öÁбíÒÔman pagesµÚ2½Ú£¬¼´ÏµÍ³µ÷ÓýÚΪÀ¶±¾¡£°´ÕÕ±ÊÕßµÄÀí½â£¬¶ÔÆä×÷ÁË´óÖµķÖÀ࣬ͬʱҲ×÷ÁËһЩССµÄÐ޸ģ¬É¾È¥Á˼¸¸ö½ö¹©ÄÚºËʹÓ㬲»ÔÊÐíÓû§µ÷ÓõÄϵͳµ÷Ó㬶Ըö±ð±¾ÈËÉÔ¾õ²»Í׵ĵط½×÷ÁËһЩСµÄÐ޸ģ¬²¢¶ÔËùÓÐÁгöµÄϵͳµ÷Óø½ÉϼòҪעÊÍ¡£ ÆäÖÐÓÐһЩº¯ÊýµÄ×÷ÓÃÍêÈ«Ïàͬ£¬Ö»ÊDzÎÊý²»Í¬¡££¨¿ÉÄܺܶàÊìϤC++ÅóÓÑÂíÉϾÍÄÜÁªÏëÆðº¯ÊýÖØÔØ£¬µ«ÊDZðÍüÁËLinuxºËÐÄÊÇÓÃCÓïÑÔдµÄ£¬ËùÒÔÖ»ÄÜÈ¡³É²»Í¬µÄº¯ÊýÃû£©¡£»¹ÓÐһЩº¯ÊýÒѾ¹ýʱ£¬±»ÐµĸüºÃµÄº¯ÊýËù´úÌæÁË£¨gccÔÚÁ´½ÓÕâЩº¯Êýʱ»á·¢³ö¾¯¸æ£©£¬µ«ÒòΪ¼æÈݵÄÔÒò»¹±£Áô×Å£¬ÕâЩº¯ÊýÎÒ»áÔÚÇ°Ãæ±êÉÏ¡°*¡±ºÅÒÔʾÇø±ð¡£ Ò»¡¢½ø³Ì¿ØÖÆ£º fork
´´½¨Ò»¸öнø³Ì clone
°´Ö¸¶¨Ìõ¼þ´´½¨×Ó½ø³Ì execve
ÔËÐпÉÖ´ÐÐÎļþ exit
ÖÐÖ¹½ø³Ì _exit
Á¢¼´ÖÐÖ¹µ±Ç°½ø³Ì getdtablesize
½ø³ÌËùÄÜ´ò¿ªµÄ×î´óÎļþÊý getpgid
»ñÈ¡Ö¸¶¨½ø³Ì×é±êʶºÅ setpgid
ÉèÖÃÖ¸¶¨½ø³Ì×é±êÖ¾ºÅ getpgrp
»ñÈ¡µ±Ç°½ø³Ì×é±êʶºÅ setpgrp
ÉèÖõ±Ç°½ø³Ì×é±êÖ¾ºÅ getpid
»ñÈ¡½ø³Ì±êʶºÅ getppid
»ñÈ¡¸¸½ø³Ì±êʶºÅ getpriority
»ñÈ¡µ÷¶ÈÓÅÏȼ¶ setpriority
ÉèÖõ÷¶ÈÓÅÏȼ¶ modify_ldt
¶Áд½ø³ÌµÄ±¾µØÃèÊö±í nanosleep
ʹ½ø³Ì˯ÃßÖ¸¶¨µÄʱ¼ä nice
¸Ä±ä·Öʱ½ø³ÌµÄÓÅÏȼ¶ pause
¹ÒÆð½ø³Ì£¬µÈ´ýÐźŠpersonality
ÉèÖýø³ÌÔËÐÐÓò prctl
¶Ô½ø³Ì½øÐÐÌض¨²Ù×÷ ptrace
½ø³Ì¸ú×Ù sched_get_priority_max
È¡µÃ¾²Ì¬ÓÅÏȼ¶µÄÉÏÏÞ sched_get_priority_min
È¡µÃ¾²Ì¬ÓÅÏȼ¶µÄÏÂÏÞ sched_getparam
È¡µÃ½ø³ÌµÄµ÷¶È²ÎÊý sched_getscheduler
È¡µÃÖ¸¶¨½ø³ÌµÄµ÷¶È²ßÂÔ sched_rr_get_interval
È¡µÃ°´RRËã·¨µ÷¶ÈµÄʵʱ½ø³ÌµÄʱ¼äƬ³¤¶È sched_setparam
ÉèÖýø³ÌµÄµ÷¶È²ÎÊý sched_setscheduler
ÉèÖÃÖ¸¶¨½ø³ÌµÄµ÷¶È²ßÂԺͲÎÊý sched_yield
½ø³ÌÖ÷¶¯Èóö´¦ÀíÆ÷,²¢½«×Ô¼ºµÈºòµ÷¶È¶ÓÁжÓβ vfork
´´½¨Ò»¸ö×Ó½ø³Ì£¬ÒÔ¹©Ö´ÐÐгÌÐò£¬³£ÓëexecveµÈͬʱʹÓà wait
µÈ´ý×Ó½ø³ÌÖÕÖ¹ wait3
²Î¼ûwait waitpid
Ïà¹ØÎĵµ£º
wait(µÈ´ý×Ó½ø³ÌÖжϻò½áÊø)
±íÍ·Îļþ
#include<sys/types.h>
#include<sys/wait.h>
¶¨Ò庯Êý pid_t wait (int * status);
º¯Êý˵Ã÷
wait()»áÔÝʱֹͣĿǰ½ø³ÌµÄÖ´ÐÐ,Ö±µ½ÓÐÐźÅÀ´µ½»ò×Ó½ø³Ì½á
Êø¡£È ......
ÖÆ×÷¿ÉÒƶ¯µÄlinuxϵͳ(Ubuntu)
1¡¢¹âÅÌÆô¶¯£¬°²×°¸´ÖƵ½Òƶ¯Ó²ÅÌ£¬½«grub°²×°µ½dev/sda¡£
2¡¢¸´ÖÆÍêºóÖØÆô£¬¹âÅÌÆô¶¯£¬°²×°Æô¶¯½çÃæÊäÈërescue£¬½øÈë¼±¾Èģʽ£¬Ñ¡Ôñ¹ÒÔØ·ÖÇøʱ£¬Ñ¡ÔñϵͳËùÔÚÓ²Å̺ͷÖÇø¡£
3¡¢ctrl-Alt-F2£¬´ò¿ªÐ´°¿Ú¡£
CODE:mount -tproc proc /target/proc
chroot /target
su
4¡¢nano /etc/mkini ......
linux Îļþϵͳ½á¹¹
/ ¸ùĿ¼
/bin ³£ÓõÄÃüÁî binary file µÄĿ¼
/boot ´æ·ÅϵͳÆô¶¯Ê±±ØÐë¶ÁÈ¡µÄµµ°¸£¬°üÀ¨ºËÐÄ (kernel) ......
3ks:http://boz8.com/house/article.aspx?aid=112
ÔÚLinuxϽøÐÐCÓïÑÔ±à³Ì£¬±ØȻҪ²ÉÓÃGNU GCCÀ´±àÒëCÔ´´úÂëÉú³É¿ÉÖ´ÐгÌÐò¡£
Ò»¡¢GCC¿ìËÙÈëÃÅ
GccÖ¸ÁîµÄÒ»°ã¸ñʽΪ£ºGcc [Ñ¡Ïî] Òª±àÒëµÄÎļþ [Ñ¡Ïî] [Ä¿±êÎļþ]
ÆäÖУ¬Ä¿±êÎļþ¿Éȱʡ£¬GccĬÈÏÉú³É¿ÉÖ´ÐеÄÎļþÃûΪ£º±àÒëÎļþ.out
ÎÒÃÇÀ´¿´Ò»Ï¾µäÈëÃųÌÐò"Hello Wor ......
ÎÊÌâµÄÒý³ö£º
µ±¶ÔͬһÎļþ¾ä±ú£¨ÔÚWindowsÏ£©»òÊÇÎļþÃèÊö·û£¨ÔÚLinuxÏ£©½øÐÐËæ»ú¶Áд²Ù×÷ʱ£¬»á´æÔÚÎļþÖ¸ÕëµÄ¶¨Î»Óë¶Á\дÁ©¸ö²½Ö裬µ«ÓÉÓÚÕâ²»ÊÇÒ»¸öÔ×Ó²Ù×÷£¬¾Í¿ÉÄܲúÉúÈçÏÂÎÊÌ⣺½ø³ÌA¶ÔijÎļþÏȶ¨Î»µ½ f1 ´¦£¬È»ºó±»Öжϣ¬È»ºó½ø³ÌB¶ÔͬһÎļþ¶¨Î»µ½ f2 ´¦£¬È» ......