´ÓÒ»µÀÃæÊÔÌâ̸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ÃüÁîÐеÄÎÄÕ£¬ÔÚϵͳÐÅÏ¢²é¿´·½Ãæѧµ½²»ÉÙÃüÁî¡£ÏëÆðÒÔǰд¹ýµÄһƪÆäʵLinuxÕâÑùÓøü¼òµ¥£¬·¢ÏÖÕâЩϵͳÐÅÏ¢²é¿´ÃüÁîÒ²¿ÉÒÔ×ܽá³öһƪССµÄ¶«Î÷À´ÁË¡£
ÁíÍâÕâÀﻹÓзdz£¶àµÄÃüÁ¿ÉÒÔ×÷Ϊ²Î¿¼¡£
ϵͳ
# uname -a &n ......
Ò».°²×°
1.µ½ÍøÉÏÏÂÔØrar for linux
2.tar zxvf rarlinux-3.7.b1.tar.gz
3.make
¶þ.ʹÓÃ
1. rar e test.rar ½âѹRARµµ
2. rar a ѹËõºóµÄÎļþÃû.rar ´ýѹÎļþ»òĿ¼
Èý.ÎÊÌâ
ÈôÔËÐÐRARÌáʾÈçÏÂ:
rar: /lib/tls/libc.so.6: version `GLIBC_2.4' not found (required by rar)
ÔòÓÃÀïÃæÌṩµÄ rar_stati ......
³É¹¦µØ¹ÜÀíÈκÎϵͳµÄ¹Ø¼üÖ®Ò»£¬ÊÇÒªÖªµÀϵͳÖÐÕýÔÚ·¢ÉúʲôÊ¡£Linux ÖÐÌṩÁËÒì³£ÈÕÖ¾£¬²¢ÇÒÈÕÖ¾µÄϸ½ÚÊÇ¿ÉÅäÖõġ£Linux ÈÕÖ¾¶¼ÒÔÃ÷ÎÄÐÎʽ ´æ´¢£¬ËùÒÔÓû§²»ÐèÒªÌØÊâµÄ¹¤¾ß¾Í¿ÉÒÔËÑË÷ºÍÔĶÁËüÃÇ¡£»¹¿ÉÒÔ±àд½Å±¾£¬À´É¨ÃèÕâЩÈÕÖ¾£¬²¢»ùÓÚËüÃǵÄÄÚÈÝÈ¥×Ô¶¯Ö´ÐÐijЩ¹¦ÄÜ¡£Linux ÈÕÖ¾´æ´¢ÔÚ /var/log Ŀ¼ÖС£ÕâÀïÓм¸¸öÓ ......
ÎÄÕÂÀ´Ô´£ºhttp://www.ibm.com/developerworks/cn/linux/l-linux-process-management/
¼¶±ð£º Öм¶
M. Tim Jones, ¹ËÎʹ¤³Ìʦ, Emulex Corp.
2009 Äê 1 ÔÂ 20 ÈÕ
Linux® µÄÓû§¿Õ¼ä½ø³ÌµÄ´´½¨ºÍ¹ÜÀíËùÉæ¼°µÄÔÀíÓë UNIX® Óкܶ๲ͬµã£¬µ«Ò²ÓÐһЩÌض¨ÓÚ Linux µÄ¶ÀÌØÖ®´¦¡£ÔÚ±¾ÎÄÖУ¬Á˽â Linux ½ø³ÌµÄÉúÃüÖÜÆ ......
CPU : ARM9 s3c2410
LCD : ¹æ¸ñ²»Ã÷£¨Õâ¸öºÜÎÞÄΣ¬µ«ÊÇÎÒËùÖªµÀµÄÖ»ÓÐÒ»¸ö·Ö±æÂÊ£©
Ô´ÂëÐ޸ģº
/linux-2.6.30.4/arch/arm/mach-s3c2410/mach-smdk2410.c
ÔÚÕâ¸öÎļþÖмÓÈëframebufferµÄ³õʼ»¯Êý¾Ý½á¹¹£¨¾ßÌåÊý¾Ý²ÎÕÕLCD¼¼ÊõÊֲᣩÈçÏ£º
#include <mach/fb.h> ......