Linux ÄÚºËWorkQueueÔĶÁ±Ê¼Ç
1. Workqueue
WorkqueueµÄÃû×־ͺÍËûµÄ¹¦ÄÜÒ»Ñù£ºÐèÒª´¦ÀíµÄ¹¤×÷ÁбíºÍ¹¤×÷µÄÌí¼Óɾ³ý£¨Ã²ËÆÃ»Óп´µ½ÈçºÎɾ³ýµÄ£©¡¢ÒÔ¼°¹¤×÷µÄµ÷¶ÈÖ´ÐС£
ÐèÒª´¦ÀíµÄ¹¤×÷Áбíͨ³£¶¼Î¬»¤ÔÚÄں˶ÔÏóworkqueue_structÀïÃæ¡£ÏµÍ³ÀïÃæ¿ÉÒÔÓжà¸öworkqueue_struct¡£Äں˲¿·ÖµÄ¹¤×÷Ìí¼Óµ½Á˹¤×÷¶ÓÁÐkeventd_wq¡£¶øfs/aio.cÀïÃæÊµÏÖÁË×Ô¼ºµÄ¹¤×÷¶ÓÁÐaio_wq¡£
workqueue_structÊÇË«ÏòÑ»·Á´±í¡£ÀïÃæµÄµ¥ÔªÊÇwork_struct¡£
Çý¶¯½Ó¿Ú£º
create_workqueue£º´´½¨¹¤×÷¶ÓÁнṹºÍÄں˴¦ÀíÏ̡߳£
schedule_work/schedule_delayed_work£ºµ÷¶ÈÖ´ÐÐÒ»¸ö¾ßÌåµÄÈÎÎñ£¬Ö´ÐеÄÈÎÎñ½«»á±»¹ÒÈëLinuxϵͳÌṩµÄworkqueue keventd_wq¡£Çë×¢Ò⣬µ÷¶ÈÖ´Ðв¢²»µÈÓÚÁ¢¿ÌÖ´ÐС£¶øÊÇָʾworker_threadÔÚÏ´δ¦Àí¹¤×÷¶ÓÁеÄʱºòÖ´Ðиù¤×÷£»
queue_work/queue_delayed_work£ºµ÷¶ÈÖ´ÐÐÒ»¸öÖ¸¶¨workqueueÖеÄÈÎÎñ¡£Äں˱¾ÉíÌṩÁËÒ»¸ö¹¤×÷¶ÓÁÐkeventd_wq¡£µ«ÊÇ£¬ÏµÍ³ÀïÃæÒ²¿ÉÒÔÓÐÆäËûµÄ¹¤×÷¶ÓÁС£ËùÒÔ¾ÍÓÐÁËschedule_workºÍqueue_workµÄÇø·Ö¡£
1.1 schedule_work
´Óschedule_workµÄʵÏÖ¿´£¬ÆäºÍqueue_workµÄʵÏÖÇø±ð²¢²»´ó£º
int schedule_work(struct work_struct *work)
{
return queue_work(keventd_wq, work);
}
int queue_work(struct workqueue_struct *wq, struct work_struct *work)
{
int ret;
ret = queue_work_on(get_cpu(), wq, work);
put_cpu();
return ret;
}
int
queue_work_on(int cpu, struct workqueue_struct *wq, struct work_struct *work)
{
int ret = 0;
Ïà¹ØÎĵµ£º
ÎÒΪʲô·¢±í²»ÁËÎÄÕÂÄØ£¿
1. ÔÚLinuxϵͳÖУ¬ÒÔ Îļþ ·½Ê½·ÃÎÊÉ豸 ¡£
2. LinuxÄÚºËÒýµ¼Ê±£¬´ÓÎļþ /etc/fstab ÖжÁȡҪ¼ÓÔØµÄÎļþϵͳ¡£
3. LinuxÎļþϵͳÖÐÿ¸öÎļþÓà i½Úµã À´±êʶ¡£
4. È«²¿´ÅÅÌ¿éÓÉËĸö²¿·Ö×é³É£¬·Ö±ðΪÒýµ¼¿é ¡¢×¨ÓÃ¿é ¡¢ i½Úµã±í¿é ºÍÊý¾Ý´æ´¢¿é¡£
5. Á´½Ó·ÖΪ£º Ó²Á´½Ó ºÍ ·ûºÅÁ´½Ó ¡£
6. ³¬ ......
ÔÚLINUX»·¾³¿ª·¢Çý¶¯³ÌÐò£¬Ê×ÏÈҪ̽²âµ½ÐÂÓ²¼þ£¬½ÓÏÂÀ´¾ÍÊÇ¿ª·¢Çý¶¯³ÌÐò¡£
³£ÓÃÃüÁîÕûÀíÈçÏ£º
ÓÃÓ²¼þ¼ì²â³ÌÐòkudzu̽²âÐÂÓ²¼þ£ºservice kudzu start ( or restart)
²é¿´CPUÐÅÏ¢£ºcat /proc/cpuinfo
²é¿´°å¿¨ÐÅÏ¢£ºcat /proc/pci
²é¿´PCIÐÅÏ¢£ºlspci (Ïà±Ècat /proc/pci¸üÖ±¹Û£©
²é¿´ÄÚ´æÐÅÏ¢ ......
×îÔç½Ó´¥LinuxÄÚºËÊÇÔÚ´óÈýµÄʱºò£¬ÄÇʱ¡¶²Ù×÷ϵͳ¡·µÄ¿Î³ÌÉè¼Æ¾ÍÊǽøÐÐLinuxÄÚºËÔ´´úÂëµÄ·ÖÎöÓë½ø³Ìµ÷¶ÈµÄ¸Ä½ø¡£ÌâÄ¿ÊÇ´óµÄÓеãÏÅÈË£¬ÌØ
±ðÊǶÔÄÇʱһ¸öÉæ×ãδÉîµÄÄêÇáÈË¿´À´¡£²»¹ýÄÇʱ×öµÄÊÂÇéºÜ¼òµ¥£¬ÈÏÈÏÕæÕæµÄ¿´ÁË¡¶LinuxÄÚºËÔ´´úÂëÇé¾°·ÖÎö¡·µÄǰÑÔ²¿·Ö£¨Ö÷Òª½²µÄAT&T»ã
±àÓïÑÔ£¬ÄÚºËÖÐÒ»Ð©ÌØÊâµÄ±à³Ì¹æÔò£©£¬Ó ......
½ñÌì¿´µ½Ê¦ÐÖ¹¤Î»ÉÏÓб¾Linux Kernel In a Nutshell£¬»¹ÊÇȫӢµÄÓ°Ó¡°æ£¬ËùÒԾͽè¹ýÀ´¿´¿´£¬·¢ÏÖÏÖÔÚ¿´Ó¢ÎĵÄÊé½¥½¥ÊÊÓ¦ÁË£¬»¹ÊDZȽÏÈÝÒ׵ģ¬ÊéÖпªÊ¼½éÉÜÈçºÎ±àÒëLinuxÄںˣ¬LinuxÄں˴óÈýµÄʱºòҲѧ¹ý±àÒë¹ý£¬µ«Êǵ±Ê±±àÒë±È½Ï¼òµ¥£¬Õâ´Î¾ö¶¨ÔÙÖØÍ·µ½Î²ºÃºÃ±àÒëһϣ¬Ê×ÏÈÏÂÔØlinux kernel£¬ÔÙÓÃsecureCRTÉÏ´«µ½Ubuntu 8. ......
¸´ÖÆÒÔÏÂÄÚÈÝ£¬±£´æÎª py ºó׺µÄÎļþ£¬¿½±´µ½wallpaperÎļþ¼Ð£¬½øÈëÎļþ¼Ð£¬ÒÔpythonÔËÐУ¬Ñ¡È¡xmlΪ±ÚÖ½
#!/usr/bin/env python2.6
# -*- coding: utf-8 -*-
# Ubuntu 9.10 dynamic wallpaper maker_Can be used in all the distributions of linux
#
# Auto generate a configuration file which you can use ......