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µÈÐÒé ......
¹¹½¨ARM Linux½»²æ±àÒ빤¾ßÁ´--Crosstool
ÔÚͬһ¸öÌåϵƽ̨ÉÏ¿ª·¢³ÌÐòÊôÓÚ±¾µØ±àÒ룬ÔÚ²»Í¬µÄÌåϵƽ̨ÉÏ¿ª·¢ÆäËûƽ̨µÄ³ÌÐò£¬Õâʱ¾ÍÐèÒªÀûÓý»²æ±àÒ빤¾ßÁ´£¬ÊôÓÚ½»²æ±àÒë¡£¶øÏÖÔÚÎÒÕýÊÇÔÚi386ƽ̨ÉÏ¿ª·¢armÌåϵµÄ³ÌÐò£¬Õâʱ¾ÍÐèÒª½»²æ±àÒ빤¾ßÁË¡£
......
topÃüÁîÊÇLinuxϳ£ÓõÄÐÔÄÜ·ÖÎö¹¤¾ß£¬Äܹ»ÊµÊ±ÏÔʾϵͳÖи÷¸ö½ø³ÌµÄ×ÊÔ´Õ¼ÓÃ×´¿ö£¬ÀàËÆÓÚWindowsµÄÈÎÎñ¹ÜÀíÆ÷¡£ÏÂÃæÏêϸ½éÉÜËüµÄʹÓ÷½·¨¡£
top - 01:06:48 up 1:22, 1 user, load average: 0.06, 0.60, 0.48
Tasks: 29 total, 1 running, 28 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3% us, 1. ......
Info
Name
Version
Home URL(Download HOme)
Install Path
Remark
MySQL
5.1.35
http://dev.mysql.com/downloads/mysql/5.1.html#source
/usr/local/mysql
Install
[root@wzhu ~]# groupadd mysql
[root@wzhu ~]# useradd -g mysql -m -d /usr/local/mysql -r mysql
[root@wzhu ~]# tar zxf mys ......
[root@apache02 home]# rpm -q -a|grep http
httpd-2.0.52-25.ent
httpd-manual-2.0.52-25.ent
system-config-httpd-1.3.1-1
httpd-devel-2.0.52-25.ent
httpd-suexec-2.0.52-25.ent
#rpm -e httpd-2.0.52-25.ent
error: Failed dependencies:
httpd-mmn = 20020903 is ......