linuxÏÂCÓïÑÔ¶àÏ̱߳à³ÌʵÀý
À¼´óÂÛ̳ÉϵÄÒ»¸öÌû×Ó¡«¡«
ѧ¶«Î÷£¬ÍùÍùʵÀý²ÅÊÇ×îÈÃÈ˸ÐÐËȤµÄ£¬ÀÏÊÇѧ»ù´¡ÀíÂÛ£¬²»¶¯ÊÖ£¬¸Ð¾õûÓгɾ͸У¬ºÇºÇ¡£
ÏÂÃæÏÈÀ´Ò»¸öʵÀý¡£ÎÒÃÇͨ¹ý´´½¨Á½¸öÏß³ÌÀ´ÊµÏÖ¶ÔÒ»¸öÊýµÄµÝ¼Ó¡£
»òÐíÕâ¸öʵÀýûÓÐʵ¼ÊÔËÓõļÛÖµ£¬µ«ÊÇÉÔ΢¸Ä¶¯Ò»Ï£¬ÎÒÃǾͿÉÒÔÓõ½ÆäËûµØ·½È¥À¡£
ÏÂÃæÊÇÎÒÃǵĴúÂ룺
/*thread_example.c : c multiple thread programming in linux
*author : falcon
*E-mail : tunzhj03@st.lzu.edu.cn
*/
#include <pthread.h>
#include <stdio.h>
#include <sys/time.h>
#include <string.h>
#define MAX 10
pthread_t thread[2];
pthread_mutex_t mut;
int number=0, i;
void *thread1()
{
printf ("thread1 : I'm thread 1\n");
for (i = 0; i < MAX; i++)
{
printf("thread1 : number = %d\n",number);
pthread_mutex_lock(&mut);
number++;
pthread_mutex_unlock(&mut);
sleep(2);
}
printf("thread1 :Ö÷º¯ÊýÔÚµÈÎÒÍê³ÉÈÎÎñÂð£¿\n");
pthread_exit(NULL);
}
void *thread2()
{
printf("thread2 : I'm thread 2\n");
for (i = 0; i < MAX; i++)
{
printf("thread2 : number = %d\n",number);
pthread_mutex_lock(&mut);
number++;
pthread_mutex_unlock(&mut);
sleep(3);
}
printf("thread2 :Ö÷º¯ÊýÔÚµÈÎÒÍê³ÉÈÎÎñÂð£¿\n");
pthread_exit(NULL);
}
void thread_create(void)
{
int temp;
memset(&thread, 0, sizeof(thread)); //comment1
/*´´½¨Ïß³Ì*/
if((temp = pthread_create(&thread[0], NULL, thread1, NULL)) != 0) //comment2
printf("Ïß³Ì1´´½¨Ê§°Ü!\n");
else
printf("Ïß³Ì1±»´´½¨\n");
if((temp = pthread_create(&thread[1], NULL, thread2, NULL)) != 0) //comment3
printf("Ïß³Ì2´´½¨Ê§°Ü&q
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
¡¡¡¡×¢ÏúϵͳµÄlogoutÃüÁî
¡¡¡¡1£¬Logout ×¢ÏúÊǵǽµÄÏà¶Ô²Ù×÷£¬µÇ½ϵͳºó£¬ÈôÒªÀ뿪ϵͳ£¬Óû§Ö»ÒªÖ±½ÓÏ´ïlogoutÃüÁî¼´¿É:
¡¡¡¡[root@localhost root]#logout
¡¡¡¡Red Hat Linuxrelease 9(Shike)
¡¡¡¡Kernel 2.4.20.8 on an i686
¡¡¡¡Login: ← »Øµ½µÇ½µÄ»Ãæ
¡¡¡¡2£¬¹Ø»ú»òÖØÐÂÆô¶¯µÄshutdownÃüÁî
¡¡¡¡Shu ......
Ŀ¼½á¹¹¼°Ö÷ÒªÄÚÈÝ “/”¸ùĿ¼²¿·ÖÓÐÒÔÏÂ×ÓĿ¼£º /usr Ŀ¼°üº¬ËùÓеÄÃüÁî¡¢³ÌÐò¿â¡¢ÎĵµºÍÆäËüÎļþ¡£ÕâЩÎļþÔÚÕý³£²Ù×÷Öв»»á±»¸Ä±äµÄ¡£Õâ¸öĿ¼Ҳ°üº¬ÄãµÄLinux·¢Ðа汾µÄÖ÷ÒªµÄÓ¦ÓóÌÐò£¬Æ©È磬Netscape¡£ /var Ŀ¼°üº¬ÔÚÕý³£²Ù×÷Öб»¸Ä±äµÄÎļþ£º¼ÙÍÑ»úÎļþ¡¢¼Ç¼Îļþ¡¢¼ÓËøÎļþ¡¢ÁÙʱÎļþºÍÒ³¸ñÊ ......
RedhatϵÁУºredhat9¡¢redhat advance server¡¢fedora¡¢centOS
¶þ¡¢ËùÐèÈí¼þ
Ø Apache 2.0.59£¨http://archive.apache.org/dist/httpd/httpd-2.0.59.tar.gz£©
Ø Opens ......
/bin = BINaries
/dev = DEVices
/etc = ETCetera
/lib = LIBrary
/proc = PROCesses
/sbin = Superuser BINaries
/tmp = TeMPorary
/usr = Unix Shared Resources
/var = VARiable ?
FIFO = First In, First Out
GRUB = GRand Unified Bootloader
IFS = Internal Field Seperators
LILO = LInux LOader
......