Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

´ÓÒ»µÀÃæÊÔÌâ̸LinuxÏÂforkµÄÔËÐлúÖÆ

ijÍâÆóÃæÊÔlinux¿ª·¢Ö°Î»ÃæÊÔÌ⣺
¸ø³öÈçÏÂC³ÌÐò£¬ÔÚlinuxÏÂʹÓÃgcc±àÒ룺
#include "stdio.h"
#include "sys/types.h"
#include "unistd.h"
int main(void)
{
pid_t pid1;
pid_t pid2;
pid1 = fork();
pid2 = fork();
printf("pid1:%d, pid2:%d\n", pid1, pid2);
}

      ÒªÇóÈçÏ£º
      ÒÑÖª´ÓÕâ¸ö³ÌÐòÖ´Ðе½Õâ¸ö³ÌÐòµÄËùÓнø³Ì½áÊøÕâ¸öʱ¼ä¶ÎÄÚ£¬Ã»ÓÐÆäËüнø³ÌÖ´ÐС£
      1¡¢Çë˵³öÖ´ÐÐÕâ¸ö³ÌÐòºó£¬½«Ò»¹²ÔËÐм¸¸ö½ø³Ì¡£
      2¡¢Èç¹ûÆäÖÐÒ»¸ö½ø³ÌµÄÊä³ö½á¹ûÊÇ“pid1:1001, pid2:1002”£¬Ð´³öÆäËû½ø³ÌµÄÊä³ö½á¹û£¨²»¿¼Âǽø³ÌÖ´ÐÐ˳Ðò£©¡£
      Ã÷ÏÔÕâµÀÌâµÄÄ¿µÄÊÇ¿¼²ìlinuxÏÂforkµÄÖ´ÐлúÖÆ¡£ÏÂÃæÎÒÃÇͨ¹ý·ÖÎöÕâ¸öÌâÄ¿£¬Ì¸Ì¸linuxÏÂforkµÄÔËÐлúÖÆ¡£
Ô¤±¸ÖªÊ¶
      ÕâÀïÏÈÁгöһЩ±ØÒªµÄÔ¤±¸ÖªÊ¶£¬¶ÔlinuxϽø³Ì»úÖƱȽÏÊìϤµÄÅóÓÑ¿ÉÒÔÂÔ¹ý¡£
      1¡¢½ø³Ì¿ÉÒÔ¿´×ö³ÌÐòµÄÒ»´ÎÖ´Ðйý³Ì¡£ÔÚlinuxÏ£¬Ã¿¸ö½ø³ÌÓÐΨһµÄPID±êʶ½ø³Ì¡£PIDÊÇÒ»¸ö´Ó1µ½32768µÄÕýÕûÊý£¬ÆäÖÐ1Ò»°ãÊÇÌØÊâ½ø³Ìinit£¬ÆäËü½ø³Ì´Ó2¿ªÊ¼ÒÀ´Î±àºÅ¡£µ±ÓÃÍê32768ºó£¬´Ó2ÖØпªÊ¼¡£
      2¡¢linuxÖÐÓÐÒ»¸ö½Ð½ø³Ì±íµÄ½á¹¹ÓÃÀ´´æ´¢µ±Ç°ÕýÔÚÔËÐеĽø³Ì¡£¿ÉÒÔʹÓÓps aux”ÃüÁî²é¿´ËùÓÐÕýÔÚÔËÐеĽø³Ì¡£
      3¡¢½ø³ÌÔÚlinuxÖгÊÊ÷×´½á¹¹£¬initΪ¸ù½Úµã£¬ÆäËü½ø³Ì¾ùÓи¸½ø³Ì£¬Ä³½ø³ÌµÄ¸¸½ø³Ì¾ÍÊÇÆô¶¯Õâ¸ö½ø³ÌµÄ½ø³Ì£¬Õâ¸ö½ø³Ì½Ð×ö¸¸½ø³ÌµÄ×Ó½ø³Ì¡£
      4¡¢forkµÄ×÷ÓÃÊǸ´ÖÆÒ»¸öÓ뵱ǰ½ø³ÌÒ»ÑùµÄ½ø³Ì¡£Ð½ø³ÌµÄËùÓÐÊý¾Ý£¨±äÁ¿¡¢»·¾³±äÁ¿¡¢³ÌÐò¼ÆÊýÆ÷µÈ£©ÊýÖµ¶¼ºÍÔ­½ø³ÌÒ»Ö£¬µ«ÊÇÊÇÒ»¸öȫеĽø³Ì£¬²¢×÷Ϊԭ½ø³ÌµÄ×Ó½ø³Ì¡£
½âÌâµÄ¹Ø¼ü
      ÓÐÁËÉÏÃæµÄÔ¤±¸ÖªÊ¶£¬ÎÒÃÇÔÙÀ´¿´¿´½âÌâµÄ¹Ø¼ü¡£ÎÒÈÏΪ£¬½âÌâµÄ¹Ø¼ü¾ÍÊÇÒªÈÏʶµ½fork½«³ÌÐòÇгÉÁ½¶Î¡£¿´ÏÂͼ£º
      ÉÏͼ±íʾһ¸öº¬ÓÐforkµÄ³ÌÐò£¬¶øforkÓï¾ä¿ÉÒÔ¿´³É½«³ÌÐòÇÐΪA¡¢BÁ½¸ö²¿·Ö¡£È»ºóÕû¸ö³ÌÐò»áÈçÏÂÔËÐУº
      step1¡¢ÉèÓÉshellÖ±½ÓÖ´ÐгÌÐò£¬Éú³ÉÁ˽ø³ÌP¡£PÖ´ÐÐÍêPart. AµÄËùÓдúÂë¡£
 &


Ïà¹ØÎĵµ£º

linuxÏ°²×°Èí¼þÏê½â

ÔÚubuntuÏ»ù±¾ÉÏÖ»Òªapt-get ¾Í¿ÉÒÔÁË£¬µ«ÊÇÓÐʱºòÒª³¢Ïʾ͵ÃÈ¥ÁíÍâÏÂÁË£¬Õâʱ¾ÍÒªÁ˽âһЩlinuxÏ°²Èí¼þµÄ֪ʶÁË£¬ËùÒÔÔÚÍøÉÏÕÒÁËÕâƪÎÄÕ£®Õª×Ô£ºCnXHacker.Net
¡¡¡¡ÔÚWindowsÏ°²×°Èí¼þʱ£¬Ö»ÐèÓÃÊó±êË«»÷Èí¼þµÄ°²×°³ÌÐò£¬»òÕßÓÃZipµÈ½âѹËõÈí¼þ½âѹËõ¼´¿É°²×°¡£ÔÚLinuxÏ°²×°Èí¼þ¶Ô³õѧÕßÀ´Ëµ£¬ÄѶȸßÓÚWindowsÏÂÈí¼ ......

RedHat Linux³£¼ûµÄÈÕÖ¾ÎļþºÍ³£ÓÃÃüÁî


³É¹¦µØ¹ÜÀíÈκÎϵͳµÄ¹Ø¼üÖ®Ò»£¬ÊÇÒªÖªµÀϵͳÖÐÕýÔÚ·¢ÉúʲôÊ¡£Linux ÖÐÌṩÁËÒì³£ÈÕÖ¾£¬²¢ÇÒÈÕÖ¾µÄϸ½ÚÊÇ¿ÉÅäÖõġ£Linux ÈÕÖ¾¶¼ÒÔÃ÷ÎÄÐÎʽ ´æ´¢£¬ËùÒÔÓû§²»ÐèÒªÌØÊâµÄ¹¤¾ß¾Í¿ÉÒÔËÑË÷ºÍÔĶÁËüÃÇ¡£»¹¿ÉÒÔ±àд½Å±¾£¬À´É¨ÃèÕâЩÈÕÖ¾£¬²¢»ùÓÚËüÃǵÄÄÚÈÝÈ¥×Ô¶¯Ö´ÐÐijЩ¹¦ÄÜ¡£Linux ÈÕÖ¾´æ´¢ÔÚ /var/log Ŀ¼ÖС£ÕâÀïÓм¸¸öÓ ......

linuxÏÂÇ¿ÖÆÐÂÓû§Ê״εǽÐÞ¸ÄÃÜÂë


Èç¹ûϵͳ¹ÜÀíԱϣÍûÌí¼ÓÒ»¸öÓû§ÒÔºó£¬ÈøÃÓû§µÚÒ»´ÎµÇ¼ÒÔºó×Ô¼ºÉèÖÃ×Ô¼ºµÄÃÜÂ룬ÄÇô¾ÍҪʹµÃÓû§µÄ³õʼÃÜÂë»òÕß¿ÕÃÜÂëÁ¢¿Ì¹ýÆÚ£¬Ç¿ÖÆÓû§µÚÒ»´ÎµÇ¼ºóÁ¢¿ÌÐÞ¸ÄÃÜÂë¡£
ΪÁËÇ¿ÖÆÓû§µÚÒ»´ÎµÇ¼ʱÉèÖÃÒ»¸öÐÂÃÜÂ룬Çë°´ÕÕÏÂÃæµÄָʾÀ´×ö£¬µ«ÊÇÐèÒªµÄ×¢ÒâµÄʱºòÈç¹ûÓû§ÊÇͨ¹ýSSHÔ¶³ÌµÇ¼½øÈ¥µÄ£¬ÄÇô¸Ã·½·¨ÊDz»ÄÜÉúЧµÄ ......

Linuxϵͳѧϰ·½·¨ÂÛ

Ê×ÏÈ,ÎÒÏëÒýÓÃһϱðÈË˵¹ýµÄÒ»¾ä»°:³ý·ÇÔÚ¹ýÈ¥µÄÊ®ÄêÄãÒ»Ö±Éú»îÔÚɽ¶´Àï,·ñÔòÄãÒ»¶¨Ìý˵¹ýlinux.
ÊǵÄ,ÏÖÔÚÌý˵¹ýlinux,
»áÒ»µãlinux»ù±¾²Ù×÷µÄÈ˶àÈçţë,È»¶øÕæÕýÄÜÓÃlinux×öÒ»µãÊÂÇéµÄÈ·ÉÙÖ®ÓÖÉÙ,Õâ¾ÍÔì³ÉÁËÏÖÔÚµÄ×´¿ö:¸÷´ó
linuxÂÛ̳ʮ·ÖÈÈÄÖ,µ«ÎÒ¹úlinuxÈ˲ÄÈ´»¹Ê®·Ö½ôȱ.µ½µ×ÊÇʲôԭÒòÔì³ÉÁËÕâÑùµÄ×´¿ö? ¾ÀÆäÔ ......

linuxϵÄyumÃüÁîÏê½â

yumÊǸÉʲôµÄ(תÔØ http://www.soft6.com/tech/16/166057.html)
¡¡¡¡Ê¹ÓÃredhat£¬fedoraµÄlinuxer¿Ï¶¨¶¼ÎªrpmÖøÃûµÄdependency
hell¶øÍ·ÌÛ(ÕâÒ²ÊÇËùÓлùÓÚrpm·¢Ðа涼ÓеÄÎÊÌâ)¡£foo is needed by bar£¬bar is needed by
foo¡£Òª×°Ð¶¸öÈí¼þ£¬»¹µÃÐÁÐÁ¿à¿àµØÊáÀíÇå³þËùÓÐÒÀÀµÐÔÎÊÌ⣬rpmµÄ¼¸¸öËÑË÷Õ¾µã³ÉÁËʱ³£¹â¹ËµÄ³¡Ë ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ