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

Linux Kernel Threads in Device Drivers

 Purpose
This examples shows how to create and stop a kernel thread.
The driver is implemented as a loadable module. In the init_module() routine five kernel threads are created. This kernel threads sleep one second, wake up, print a message and fall asleep again. On unload of the module (cleanup_module), the kernel threads are killed.
The example has been tested with Linux kernel 2.4.2 on Intel (uni processor only) and Alpha platform (COMPAQ Personal Workstation 500au (uni processor), DS20 and ES40 (SMP).
A version for the 2.2 kernel can be found here. Note: depending on the context of the creator of the threads the new threads may inherit properties from the parent you do not want to have. The new version avoids this by having keventd create the threads. The 2.2. kernel do not have a keventd, so this approach is not implementable there.
Functions in example
    * start_kthread: creates a new kernel thread. Can be called from any process context but not from interrupt. The functions blocks until the thread started.
    * stop_kthread: stop the thread. Can be called from any process context but the thread to be terminated. Cannot be called from interrupt context. The function blocks until the thread terminated.
    * init_kthread: sets the environment of the new threads. Is to be called out of the created thread.
    * exit_kthread: needs to be called by the thread to be terminated on exit
Creation of new Thread
A new thread is created with kernel_thread(). The thread inherits properties from its parents. To make sure that we do not get any weired properties, we let keventd create the new thread.
The new thread is created with start_kthread(). It uses a semaphore to block until the new thread is running. A down() blocks the start_kthread() routine until the corresponding up() call in init_kthread() is executed.
The new thread must call init_kthread() in order to let the creator continue.


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì(Áù) L2CAP±à³ÌʵÀý

ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
 Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

linuxµÄfreeÃüÁî

 [root@nonamelinux ~]# free
total used free shared buffers cached
Mem: 386024 377116 8908 0 21280 155468
-/+ buffers/cache: 200368 185656
Swap: 393552 0 393552
ÏÂÃæÊǶÔÕâЩÊýÖµµÄ½âÊÍ£º
µÚ¶þÐÐ(mem)£º
total:×ܼÆÎïÀíÄÚ´æµÄ´óС¡£
used:ÒÑʹÓöà´ó¡£
free:¿ÉÓÃÓжàÉÙ¡£
Shared:¶à¸ö½ø³Ì¹²ÏíµÄÄÚ ......

linuxÖÐapacheÅäÖÃ

Ò»¡¢       ±³¾°
1£®Ê²Ã´ÊÇApache £¿
Apache£¬ÊÇÒ»ÖÖ¿ª·ÅÔ´ÂëµÄHTTP·þÎñÆ÷£¬¿ÉÒÔÔÚ´ó¶àÊý²Ù×÷ϵͳÖÐÔËÐУ¬ÓÉÓÚÆä¶àƽ̨ºÍ°²È«ÐÔËùÒÔ±»¹ã·ºÊ¹Óã¬ÊÇÄ¿Ç°×îÁ÷ÐеÄWeb·þÎñÆ÷Èí¼þÖ®Ò»¡£Apache Æð³õÓÉ Illinois ´óѧ Urbana-Champaign µÄ¹ú¼Ò¸ß¼¶¼ÆËã³ÌÐòÖÐÐÄ¿ª·¢£¬¿ªÊ¼ApacheÖ»ÊÇ×÷ΪNetscapeÍ ......

LinuxÏÂOpenEv±àÒë°²×°

 °ÑGDAL°²×°Ä¿Â¼ÏµÄ../bin/gdal-config¸´ÖƵ½/usr/bin/Ï£¬·ñÔò³öÏÖ“ÕÒ²»µ½gdal-config”
°Ñproj4°²×°Ä¿Â¼ÏµÄ../include/proj_api.h¸´ÖƵ½GDAL°²×°Ä¿Â¼ÖеÄincludeÖУ¬·ñÔò³öÏ֓䶨Òåproj_api.h”»òÕßÖ±½Ó°Ñproj4°²×°µ½Ä¬ÈÏ·¾¶£¬·ñÔò»áÌáʾ“ÕÒ²»µ½ -lproj”¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ