linuxÏÂʵÏÖ¶àÏß³Ìͬ²½£¨Ò»£©
²Î¿¼×ÊÁÏ£ºhttp://baike.baidu.com/view/400319.htm
¡¡LinuxϵͳϵĶàÏß³Ì×ñÑPOSIXÏ߳̽ӿڣ¬³ÆΪpthread¡£±àдLinuxϵĶàÏ̳߳ÌÐò£¬ÐèҪʹÓÃÍ·Îļþpthread.h£¬Á¬½ÓʱÐèÒª ʹÓÿâlibpthread.a¡£Ë³±ã˵һÏ£¬LinuxÏÂpthreadµÄʵÏÖÊÇͨ¹ýϵͳµ÷ÓÃclone£¨£©À´ÊµÏֵġ£clone£¨£©ÊÇLinuxËùÌØ ÓеÄϵͳµ÷Óã¬ËüµÄʹÓ÷½Ê½ÀàËÆfork£¬¹ØÓÚclone£¨£©µÄÏêϸÇé¿ö£¬ÓÐÐËȤµÄ¶ÁÕß¿ÉÒÔÈ¥²é¿´ÓйØÎĵµËµÃ÷¡£ÏÂÃæÎÒÃÇչʾһ¸ö×î¼òµ¥µÄ¶àÏ̳߳ÌÐò example1.c
#include <stdio.h>
#include <pthread.h>
#include<sys/types.h>
void thread(void){
int i;
for(i=0;i<3;i++)
printf("This is a pthread.\n");
}
int main(void){
pthread_t id;
int i,ret;
ret = pthread_create(&id,NULL,(void*)thread,NULL);
if(ret!=0){
printf ("Create pthread error!\n");
// exit (1);
}
for(i=0;i<3;i++)
printf("This is the main process.\n");
pthread_join(id,NULL);
return (0);
}
ÎÒÃDZàÒë´Ë³ÌÐò£º
¡¡¡¡gcc example1.c -lpthread -o example1
ÎÒËùʹÓõÄÊÇÀÏʦ½ÌµÄ gcc example.c -g -o example -l phread
ÔËÐÐexample1£¬ÎÒÃǵõ½ÈçϽá¹û£º
This is the main process.
This is a pthread.
This is the main process.
This is the main process.
This is a pthread.
This is a pthread.
ÔÙ´ÎÔËÐУ¬ÎÒÃÇ¿ÉÄܵõ½ÈçϽá¹û£º
This is a pthread.
This is the main process.
This is a pthread.
This is the main process.
This is a pthread.
This is the main process.
¡¡¡¡Ç°ºóÁ½´Î½á¹û²»Ò»Ñù£¬ÕâÊÇÁ½¸öÏß³ÌÕù¶áCPU×ÊÔ´µÄ½á¹û¡£ÉÏÃæµÄʾÀýÖУ¬ÎÒÃÇʹÓõ½ÁËÁ½¸öº¯Êý£¬¡¡pthread_createºÍpthread_join£¬²¢ÉùÃ÷ÁËÒ»¸öpthread_tÐ͵ıäÁ¿¡£
¡¡¡¡pthread_tÔÚÍ·Îļþ/usr/include/bits/pthreadtypes.hÖж¨Ò壺
¡¡¡¡typedef unsigned long int pthread_t;
¡¡¡¡ËüÊÇÒ»¸öÏ̵߳ıêʶ·û¡£º¯Êýpthread_createÓÃÀ´´´½¨Ò»¸öỊ̈߳¬ËüµÄÔÐÍΪ£º
¡¡¡¡extern int pthread_create __P ((pthread_t *__thread, __const pthread_attr_t *__attr,
¡¡¡¡void *(*__start_routine) (void *), void *__arg));
¡¡¡¡µÚÒ»¸ö²ÎÊýΪָÏòÏ̱߳êʶ·ûµÄÖ¸Õ룬µÚ¶þ¸ö²ÎÊýÓÃÀ´ÉèÖÃÏß³ÌÊôÐÔ£¬µÚÈý¸ö²ÎÊýÊÇÏß³ÌÔËÐк¯ÊýµÄÆðʼµØÖ·
Ïà¹ØÎĵµ£º
11ÔÂ9ÈÕÏûÏ¢£¬¾Ý¹úÍâýÌ屨µÀ£¬Î¢ÈíÇ°Ñз¢ÈËÔ±¿Ë¹¿â¶ûµÙ˹(Keith Curtis)½üÈÕ±íʾ£¬×¨ÊôÈí¼þ(proprietary software)³ÙÔ罫ÃðÍö£¬Ãâ·ÑµÄLinux½«È¡¶ø´úÖ®¡£
¿â¶ûµÙ˹ÈÏΪ£¬Ãâ·ÑÈí¼þ×îÖÕ½«Õ½Ê¤¸¶·ÑÈí¼þ£¬³ÉΪһÖÖÇ÷ÊÆ¡£Ä¿Ç°£¬Ðí¶àÈËÈÏΪÃâ·ÑÈí¼þ²»¿É¿¿£¬µ«ÕâÖÖ¹ÛÄî»á²»¶Ï¸Ä±ä£¬Ö±ÖÁÃâ·ÑÈí¼þ³ÉΪÖ÷Á÷¡£
ÖÁÓÚ΢ÈíµÄδÀ´³ö·£¬ ......
½ñÌì°Ñ×î½üѧϰubuntuϵͳµÄÀú³ÌÉÔ×÷×ܽá,Ï£Íû¶ÔÐÂÊÖÓÐÓÃ.
ÒÔÎÒµçÄÔΪÀý,˵һϹػúÖØÆôÃüÁî.ºìÉ«¼´ÎªÃüÁî
[root@liwangjun1990 root]#logout ---×¢ÏúÕË»§
[root@liwangjun1990 root]#shutdown –h now —— ......
½øÈëviºó ÓÐÁ½ÖÖģʽ
1.±à¼Ä£Ê½
2.ÃüÁîģʽ
½øÈëviºóĬÈÏÊÇÃüÁîģʽ£¬ËùÒÔ²»ÒªÂÒ°´ ¾Í»áµÃµ½ddµÄ¾¯¸æÉù£¬ÒªÊäÈëÎÄ×ֵĻ° Çë°´aºói ¾Í¿ÉÒÔ¿ªÊ¼ÊäÈëÎÄ×ÖÀ£¡
ÊäÈë½áÊøºó Çë°´esc¼ü»ØÃüÁîģʽ
ÊäÈëq¾ÍÊÇÍ˳ö
ÊäÈëwq¾ÍÊÇ´æÅ̺óÍ˳ö
ÊäÈëq!·ÅÆú´æÅÌÇ¿ÐÐÍ˳ö
.
Vi µÄʹÓÃ
Vi ÒѾÊÇ Unix ϵͳÖбê×¼µÄÎÄ×Ö±à¼Æ ......
ÎÒÓõÄUBUNTU9.04 ¡£
×°JDKʱ³öÏÖÁËDeleting temporary files...
ÆÁÄ»³ÖÐøÊ®¼¸·ÖÖÓ¶¼»¹ÊÇDeleting temporary files...¿´À´ÊÇ×°²»ÁËÁË¡£ÖØпªÊ¼×°Ò»´Î
sudo chmod a+x ./jre-6u16-linux-i586.bin
sudo ./jre-6u16-linux-i586.bin
È»ºóÔÚÖÕ¶ËÅäÖû·¾³±äÁ¿£º
export JAVA_HOME=/usr/java/jdk1.6.0_16
&n ......
linuxÏÂÊÖ¶¯É¾³ýÊý¾Ý¿âʵÀý£¬Ö±½Óɾ³ýÏàÓ¦µÄĿ¼¾Í¿ÉÒÔÁË£¬²»¶à˵ÁË....
1. $ORACLE_HOME/dbs/
[oracle9@frogger dbs]$ pwd
/u01/app/oracle/product/9.2.0.1/dbs
[oracle9@frogger dbs]$ rm inittest02.ora
[oracle9@frogger dbs]$ rm orapwdtest02
2. $ORACLE_BASE/oradata/SID
[oracle9@frogger oradata]$ ......