Linux ¶àÏ̱߳à³Ì
linux ¶àÏ̱߳à³Ì·Ç³£¼òµ¥¡£
Ò»¡¢¶àÏ̱߳à³ÌµÄÁ÷³Ì£º
´´½¨Ïß³Ì--->µ±Ç°Ï̼߳ÌÐø¹¤×÷--->£ÛÓë´´½¨µÄÏß³Ìͬ²½£Ý--->£ÛµÈ´ý´´½¨µÄÏ߳̽áÊøÓë·µ»Ø£Ý--->µ±Ç°Ï̼߳ÌÐø¹¤×÷¡£
--->´´½¨µÄÏ߳̿ªÊ¼¹¤×÷--->£ÛÓë±ðµÄÏß³Ìͬ²½£Ý--->Í˳öÏ̲߳¢·µ»Ø
Ïß³ÌÓõöÖ÷ÒªµÄº¯Êý¡£
1.Ï̴߳´½¨º¯Êý£ºpthread_create(pthread_t * id,pthread_attr_t *attr,void *(*start_routine)(void*),void *arg);
id---Ïß³Ìid ,Ï̴߳´½¨³É¹¦Ê±µÄ·µ»ØÖµ£¬ÓÃÓÚ¶ÔÏ̵߳IJÙ×÷¡£
attr---Ïß³ÌÊôÐÔ£¬¼òµ¥µÄÉèΪNULL¾Í¿ÉÒÔÁË¡£
void *(*start_routine)(void*) --- Ï̺߳¯Êý£¬Ò²¾Í¹¤×÷Ï̵߳Äʵ¼ÊÔËÐв¿·ÖµÄ´úÂë¶Î¡£
arg --- Ï̲߳ÎÊý£¬ÊÇË«ÏòµÄ£¬Ò²¾ÍÊÇÒ»¸öÊäÈëÊä³öÀàÐ͵IJÎÊý¡£
2.µÈ´ýÏ̷߳µ»Øº¯Êý£ºpthread_join(pthread_t id,void *ret);
id--- Ïß³Ìid¡£
ret --- Ï̵߳ķµ»ØÖµ¡£
3.Í˳öỊ̈߳ºpthread_exit(void *ret);
ret --- Ï̷߳µ»ØÖµ¡£
Ò»¸ö¼òµ¥µÄÏ̵߳ÄÀý×Ó£º
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
void *thread_function(void *arg);
char message[] = "Hello World";
int main() {
int res;
pthread_t a_thread;
void *thread_result;
res = pthread_create(&a_thread, NULL, thread_function, (void *)message);
if (res != 0) {
perror("Thread creation failed");
exit(EXIT_FAILURE);
}
printf("Waiting for thread to finish...\n");
res = pthread_join(a_thread, &thread_result);
if (res != 0) {
perror("Thread join failed");
exit(EXIT_FAILURE);
}
printf("Thread joined, it returned %s\n", (char *)thr
Ïà¹ØÎĵµ£º
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
Ò»¡¢ÒýÑÔ£º
±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØÍ¼£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾Ñ飨Õâ¸ö»¹µ ......
»ùÓÚ½ø³ÌµÄÃüÁʽ²é¿´:
`ps -o pcpu,pmem,nlwp -p $PID`
#(pmem = % mem usage and nlwp is number of threads)
ÆäÖÐpcpu¶¨ÒåÊÇ:cpu utilization of the process in “##.#” format. It is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a ......
CurlÊÇLinuxÏÂÒ»¸öºÜÇ¿´óµÄhttpÃüÁîÐй¤¾ß£¬Æä¹¦ÄÜÊ®·ÖÇ¿´ó¡£
1) ¶ÁÈ¡ÍøÒ³
$ curl http://www.linuxidc.com
2) ±£´æÍøÒ³
$ curl http://www.linuxidc.com > page.html
$ curl -o page.html http://www.linuxidc.com
3) ʹÓõÄproxy·þÎñÆ÷¼°Æä¶Ë¿Ú£º -x
$ curl -x 123.45.67.89:1080 -o page.html http://www.linu ......
ÓÉÓÚLINUX
CûÓжÔ×Ö·û´®×Ó´®Ìæ»»¹¦ÄÜ,ËùÒÔÎÒ×Ô¼ºÐ´ÁËÒ»¸östr_replaceº¯Êý,ʵÏÖÁË×Ö·û´®Ìæ»».
Çë´ó¼Ò²Î¿¼.
/*
* FUNCTION : str_replace
*
ABSTRACT : replace child string in a string.
*
PARAMETER &nbs ......