Linuxϵ÷ÓÃpthread¿âʵÏÖ¼òµ¥Ï̳߳Ø
	
    
    
	#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <pthread.h>
#include <assert.h>
void * routine(void * arg);
int pool_add_job(void *(*process)(void * arg),void *arg);
int pool_init(unsigned int thread_num);
int pool_destroy(void);
void *test(void *);
/* We define a queue of jobs which will be processed in thread pool*/
typedef struct job{
	void * (*process)(void *arg); /* process() will employed on job*/
	void *arg;/* argument to process */
	struct job * next;
}Job;
/* 
 * A threadpool must have the following parts:
 * threads:			a list of threads
 * jobs   :			jobs in thread pool
 * pool_lock:		pthread_mutex_lock for thread pool
 * job_ready:		pthread_cond_t for job ready
 * destroy:			flag indicate whether the pool shall be destroyed
 * size:			current size of jobs list
 * thread_num:		max thread num initialized in pool
 */
typedef struct thread_pool{
	pthread_mutex_t pool_lock;
	pthread_cond_t  job_ready;
	Job * jobs;
	int destroy;
	pthread_t * threads;
	unsigned int thread_num;
	int size;
}Thread_pool;
/* global Thread_pool variable*/
static Thread_pool * pool=NULL;
/*Initialize the thread pool*/
int pool_init(unsigned int thread_num)
{
	pool=(Thread_pool *)malloc(sizeof(Thread_pool));
	if(NULL==pool)
		return -1;
	pthread_mutex_init(&(pool->pool_lock),NULL);
	pthread_cond_init(&(pool->job_ready),NULL);
	pool->jobs=NULL;
	pool->thread_num=thread_num;
	pool->size=0;
	pool->destroy=0;
	pool->threads=(pthread_t *)malloc(thread_num * sizeof(pthread_t));
	
	int i;
	for(i=0;i<thread_num;i++){
		pthread_create(&(pool->threads[i]),NULL,routine,NULL);
	}
	return 0;
}
/*
 * Add job into the pool
 * assign it to some thread
 */
int pool_add_job(void *(*process)(void *),void *arg)
{
	Job * newjob=(Job *)malloc(sizeof(Job));
	newjob->process=process;
	newjob->arg=arg;
	newjob->next=NUL
    
     
	
	
    
    
	Ïà¹ØÎĵµ£º
        
    
    MySQL :: Linux ÏÂ×Ô¶¯±¸·ÝÊý¾Ý¿âµÄ shell ½Å±¾ 
Linux ·þÎñÆ÷ÉϵijÌÐòÿÌì¶¼ÔÚ¸üРMySQL Êý¾Ý¿â£¬ÓÚÊǾÍÏëÆðдһ¸ö shell ½Å±¾£¬½áºÏ crontab£¬¶¨Ê±±¸·ÝÊý¾Ý¿â¡£Æäʵ·Ç³£¼òµ¥£¬Ö÷Òª¾ÍÊÇʹÓà MySQL ×Ô´øµÄ mysqldump ÃüÁî¡£ 
½Å±¾ÄÚÈÝÈçÏ£º 
#!/bin/sh 
# File: /home/mysql/backup.sh 
# Database info 
DB_NAME=" ......
	
    
        
    
    °²×°mysql
sudo apt-get install mysql-servel-5.0 mysql-client-5.0
ÏÂÔØ°²×°¹ý³ÌÖУ¬»áÌáʾÊäÈërootÃÜÂë
°²×°CÓïÑÔ±à³Ì½Ó¿Ú£º
 sudo apt-get install libmysqlclient15-dev
¸ü¶àapi ²é¿´£ºhttp://dev.mysql.com/doc/refman/5.0/en/c.html
Ïà¹ØmysqlÍ·ÎļþºÍ¿âÎļþ°²×°ÔÚ/usr/include/mysql/ºÍ/usr/lib/mysqlÄ¿ ......
	
    
        
    
    
LINUX Ï̺߳¯Êý´óÈ«
Ïß³Ì
´´½¨Ò»¸öȱʡµÄÏß³Ì
ȱʡµÄÏ̵߳ÄÊôÐÔ£º
l         ·Ç°ó¶¨
l         δ·ÖÀë
l         Ò»¸öȱʡ´óСµÄ¶ÑÕ»
l       &nb ......
	
    
        
    
    Ð޸ı¾µØÓû§ÃÜÂ룺
1¡¢½»»¥ÅäÖñ¾µØÓû§£º
ÒÔrootÓû§£º
passwd <username>
Changing passWord
 for user dewang.
New UNIX passWord
: 
BAD PASSWord
: it is too short
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.
ÒÔ·ÇrootÓû§ÐÞ¸Ä×Ô¼ºµÄÃÜÂ루עºóÃæ²»Äܸ ......
	
    
        
    
    ²é¿´°²×°µÄϵͳÐÅÏ¢£º
   ¼òµ¥µÄÐÅÏ¢£ºuname -a 
   ÏêϸµÄÐÅÏ¢£ºcat /proc/version
     cat /etc/issue
     lsb_release -a
GentooÉϰ²×°mysql£¬Ö±½ÓÔËÐУº
  (1) bigner
@localhost
 / $ sudo emerge mysql
  ......