linux fork() º¯ÊýʵÀýÏê½â
forkº¯Êýѧϰ£º
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
main ()
{
pid_t pid; pid=fork();
if (pid < 0)
printf("error in fork!");
else if (pid == 0)
printf("i am the child process, my process id is %dn",getpid());
else
printf("i am the parent process, my process id is %dn",getpid());
}
Õâ¶Î´úÂëдÁËÒ»¸öʹÓÃforkº¯Êý´´½¨×Ó½ø³Ì£¬¸¸×Ó½ø³ÌͬʱÔËÐжø²úÉú½»´íµÄ£¬²»Ò»ÑùµÄÔËÐнá¹û¡£ÔËÐнá¹ûÈçÏ£º
# ./a.out
i am the child process, my process id is 4286
i am the parent process, my process id is 4285
forkÔÚÓ¢ÎÄÖÐÊDzæ×Ó£¬·Ö²æµÄÒâ˼£¬ÔÚº¯ÊýforkÖУ¬È¡ºóÃæµÄÒâ˼¡£ºÜÐÎÏóµÄ±íʾ³ÌÐò´ÓÕâÀï·Ö²æ£¬forkº¯Êý´´½¨ÁË×Ó½ø³Ì£¬×Ó½ø³ÌºÍ¸¸½ø³Ìͬʱ£¨ÆäʵÊÇcpu·Öʱ´¦Àí£©¿ªÊ¼ÔËÐзֲæÖ®ºóµÄ³ÌÐò¡£
³ÌÐò¸ÄдÏ£º
main()
{
pid_t pid;
printf("\n[%d]not fork pid=%d\n",getpid(),pid);
pid=fork();
printf("\n[%d]forked pid=%d\n",getpid(),pid);
if(pid<0)
{
printf("error in fork!\n");
getchar();
exit(1);
}
else if(pid==0)
printf("\n[%d]in child process,p_id=%d\n",getpid(),getpid());
else
{
printf("\n[%d]in parent process,my pid=%d\n",getpid(),pid);
printf("\n[%d]in parent process,my getpid=%d\n",getpid(),getpid());
}
}
³ÌÐòÔËÐнá¹ûÈçÏ£º
$ ./fork
[3819]not fork
[3820]forked pid=0
[3820]in child process,p_id=3820
[3819]forked pid=3820
[3819]in parent process,my pid=3820
[3819]in parent process,my getpid=3819
¿ÉÒÔÇå³þµÄ¿´µ½ not forkÖ»´òÓ¡ÁËÒ»´Î£¬ÆäÖÐ[3819]ÊǸ¸½ø³ÌµÄ½ø³ÌºÅ£¬´´½¨forkÒÔºó£¬forkº¯Êý·µ»Ø¸ø¸¸½ø³ÌµÄÖµpidÊÇ×Ó½ø³ÌµÄ½ø³ÌºÅ[3820]£¬¶øÔÚ×Ó½ø³ÌÖУ¬pidֵΪÁã¡£Ò²¾ÍÊÇ˵×Ó½ø³ÌÖУ¬pid±»ÖÃÁã¡£ ÒýÓÃÍøÉÏһλÍøÓѵĽâÊÍ“Æäʵ¾ÍÏ൱ÓÚÁ´±í£¬½ø³ÌÐγÉÁËÁ´±í£¬¸¸½ø³Ìpid(p Òâζpoint)Ö¸Ïò×Ó½ø³ÌµÄ½ø³
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
vmwareÖÐlinuxÉÏÍøÉèÖ×—NAT
ÉèÖóÉNAT·½Ê½ºó£¬½«ÄãwindowsÖ÷»úÉÏÍøµÄÄǸöÍøÂçÉèÖÃΪ¹²Ïí£¬È»ºó½«linux¿Í»§»úºÍwindowsÖ÷»ú×é³ÉÄÚÍø¡£¾ßÌå²½ÖèÈçÏÂ;
1¡¢ÉèÖÃvmwareµÄ¿Í»§»úÍøÂçÁ´½ÓΪNAT·½Ê½£º
2¡¢½«ÄãwindowsÉÏÍøµÄÄǸöÍøÂçÉèΪ¹²Ïí¸øvnet8£¬Ò»°ã¹Ì¶¨ip¾ÍÊÇ“±¾µØÁ¬½Ó”£¬¿í´øÉÏÍø¾ÍÊ ......
LinuxÏÂSVN·þÎñÆ÷µÄ´î½¨ÓëÅäÖÃ
ÏÂÔØ×îеÄsvnѹËõ°ü
http://subversion.tigris.org/servlets/ProjectDocumentList?expandFolder=260&folderID=260
//½âѹSubVersion°²×°°ü (rootÓû§½øÐÐÏÂÃæµÄ²Ù×÷) # tar xvzf subversion-1.4.5.tar.gz
//½øÈë½âѹºóµÄĿ¼
# cd Subversion-1.4.5
//ÅäÖÃsubversion°²×°
#./conf ......
ά»¤LinuxµÄssh¹¤¾ßÔÚʹÓÃÖУ¬Ò»µ©Óöµ½ÍøÂçÖжϣ¬Ôòµ±Ç°µÄshell¾Í»á×Ô¶¯¹Ø±Õ
µ±Ç°µÄ¹¤×÷½ø¶È¾Í»á¶ªÊ§£¬Õâ¶ÔÓÚÔ¶³ÌÉý¼¶µÈ±È½ÏºÄ·Ñʱ¼äµÄ¹¤×÷ÊǷdz£²»ÀûµÄ
¶ÔÓÚÔ¶³Ìµ÷ÊÊ´úÂëÒ²ÊǺܲ»¿É¿¿²»°²È«µÄ
Ϊ´Ë£¬¿ÉÒÔʹÓÃscreenÕâ¸ö¹¤¾ßÀ´½â¾öÕâ¸öÎÊÌâ¡£
¶ÔÓÚ×îС»¯µÄlinux£¬Í¨³£screenÊDz»°üº¬ÔÚϵͳÄڵġ£
ÐèÒª²éÕÒ²Ù×÷ϵͳµÄ°² ......