Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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´´½¨Ê§°Ü");
else
printf("Ïß³Ì2±»´´½¨\n");
}
void thread_wait(void)
{
/*µÈ´


Ïà¹ØÎĵµ£º

LinuxÄÚºËÅäÖÃÎĵµ(make menuconfig)

Ò»¡¢ÒýÑÔ£º
    ±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØͼ£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾­Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾­Ñ飨Õâ¸ö»¹µ ......

µÚ1 ²¿·Ö£ºLinux »ù´¡

ÔÚ±¾½Ì³ÌÖУ¬ÎÒÃǽ«¸øÄú½éÉÜ bash£¨±ê×¼µÄ Linux shell£©£¬ÎªÄúչʾÈçºÎ³ä·ÖÀûÓÃÈç ls¡¢cp ºÍ mv ÕâÑùµÄ±ê×¼ Linux ÃüÁ²¢ÏòÄú½²½â Linux µÄȨÏÞºÍËùÓÐȨģÐÍÒÔ¼°¸ü·á¸»µÄÄÚÈÝ¡£ÔÚ±¾½Ì³Ì½áÊøÖ®¼Ê£¬Äú½«¾ßÓÐ Linux »ù´¡ÖªÊ¶·½ÃæµÄÔúʵ»ù´¡£¬ÉõÖÁ»¹¿ÉÒÔ×¼±¸¿ªÊ¼Ñ§Ï°Ò»Ð©»ù±¾µÄ Linux ϵͳ¹ÜÀíÈÎÎñ·½ÃæµÄ֪ʶ¡£
Ò»¡£¹ØÓÚ±¾½ ......

DIY£º×Ô¼º¶¯ÊÖ×öÒ»¸öÃÔÄã Linux ϵͳ

http://www.ibm.com/developerworks/cn/linux/embed/diy/
DIY£º×Ô¼º¶¯ÊÖ×öÒ»¸öÃÔÄã Linux ϵͳ
ÎĵµÑ¡Ïî
<tr valign="top"><td width="8"><img alt="" height="1" width="8" src="//www.ibm.com/i/c.gif"/></td><td width=&quo ......

redhat linuxÃüÁî´óÈ«


Ò». Æô¶¯,¹Ø»ú,µÇÈë,µÇ³öÏà¹ØÃüÁî
<login> 怬
<logout> µÇ³ö
<exit> µÇ³ö
<shutdown> ֹͣϵͳ
<halt> ֹͣϵͳ
<reboot> ÖØÆô¶¯
<poweroff> ÇжϵçÔ´
<sync> °ÑÄÚ´æÀïµÄÄÚÈÝдÈë´ÅÅÌ
<lilo> °²×°liloÆô¶¯¹ÜÀí³ÌÐò
<grub> °²×°liloÆô¶¯¹ÜÀí³ÌÐò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ