LinuxÄÚºËÎĵµÖ®rbtree.txt
Red-black Trees (rbtree) in Linux
January 18, 2007
Rob Landley <rob@landley.net>
=============================
red-blackÊ÷ÊÇʲôÑùµÄÊ÷£¬ÎªÊ²Ã´ÐèÒªred-blackÊ÷£¿
------------------------------------------------
red-black tree£¨RBÊ÷£©ÊÇÒ»ÖÖƽºâ¶þ²æÊ÷£¬ËüÖ÷ÒªÓÃÓÚ´æ´¢»òÕß˵Ë÷Òý¿ÉÅÅÐòµÄ¼ü
Öµ¶ÔÊý¾Ý¡£RBÊ÷£¨ºìºÚÊ÷£©ÓëradixÊ÷ºÍhash±í¶¼²»Í¬¡£radixÊ÷ÊÇÒ»ÖֱȽÏÊʺÏÓÃÓÚ
´æ´¢Ï¡ÊèµÄÊý¾Ý¼¯¶øÇÒ½«ÓÃÒ»¸ö´óÕûÊý½øÐвåÈ룬ɾ³ý£¬²éÕҵIJÙ×÷»ù´¡¡£¶øhash±í
²¢²»ÊÇÒÔijÖÖÅÅÐò˳Ðò½øÐд洢£¬¶øÇÒ±ØÐëÖ¸¶¨´óСºÍhashº¯Êý¡£
RBÊ÷ÓëAVLÊ÷ºÜÏàËÆ£¬µ«ÊDZÈAVLÊ÷ÓиüºÃµÄ²åÈëºÍɾ³ý×Çé¿öµÄʱ¼ä¸´ÔӶȣ¬ÒÔ¼°
O(log n)µÄ×²éÕÒʱ¼ä¸´ÔӶȡ£
ÒýÓÃ:
ÔÚLinuxÖÐÓкܶàµØ·½Óõ½ÁËRDÊ÷¡£anticipatory, deadline, ºÍCFQ I/Oµ÷¶È¶¼Ê¹ÓÃ
µÄÊÇRBÊ÷½øÐÐÇëÇó¸ú×Ù£¬»¹ÓÐCD/DVDÇý¶¯µÄ°ü¹ÜÀíÒ²ÊÇÈç´Ë¡£
¸ß¾«¶È¼ÆʱÆ÷£¨high-resolution timer£©Ê¹ÓÃRBÊ÷×éÖ¯¶¨Ê±ÇëÇó¡£
EXT3ÎļþϵͳҲʹÓÃRBÊ÷À´¹ÜÀíĿ¼¡£
ÐéÄâ´æ´¢¹ÜÀíϵͳҲÊÇÓÐRBÊ÷½øÐÐVMAs£¨Virtual Memory Areas£©µÄ¹ÜÀí¡£
µ±È»»¹ÓÐÎļþÃèÊö·û£¬ÃÜÂëÔ¿³×£¬“µÈ¼¶ÁîÅÆÍ°”µ÷¶ÈµÄÍøÂçÊý¾Ý°ü¶¼ÊÇÓÃRBÊý¾Ý½ø
ÐÐ×éÖ¯ºÍ¹ÜÀíµÄ¡£
Ïà¹Ø×ÊÁÏ£º
Linux Weekly News article on red-black trees
http://lwn.net/Articles/184495/
Wikipedia entry on red-black trees
http://en.wikipedia.org/wiki/Red-black_tree
¿É¼ûRBÊ÷£¨ºìºÚÊ÷£©ÔÚLinuxÄÚºËÖеÄÖØÒªÐÔ¡£
LinuxÄں˵ÄRBÊ÷ʵÏÖ
---------------------------------------
ÔÚLinuxÄÚºËÔ´´úÂëÖÐrbÊ÷µÄʵÏÖÔÚlib/rbtree.cÎļþÖУ¬¿ÉÒÔͨ¹ý
#include "linux/rbtree.h"½øÐÐʹÓá£
ÔÚLinuxÄÚºËÖеÄRBÊ÷ʵÏÖÓ봫ͳµÄʵÏÖ·½
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍ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 ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
Ò»¡¢°²×°
´´½¨°²×°Ä¿Â¼£¬ÔÚ/usr/local/javaϽ¨Á¢°²×°Â·¾¶£¬²¢½«Îļþ¿¼µ½¸Ã·¾¶Ï£º
# mkdir /usr/local/java
1¡¢jdk-6u11-linux-i586.bin
Õâ¸öÊÇ×Ô½âѹµÄÎļþ£¬ÔÚlinuxÉÏ°²×°ÈçÏ£º
# chmod 755 jdk-6u11-linux-i586.bin
# ./jdk-6u11-linux-i586.bin
ÔÚ°´ÌáʾÊäÈëyesºó£¬jdk±»½âѹ¡£
......
Linux ÐéÄâÎļþϵͳ¸Å¹Û
×÷Õß Richard Gooch <rgooch@atnf.cs.iro.au>
·Òë albcamus <albcamus@gmail.com>
×îºó¸üÐÂ:2007 Äê 6 Ô 24 ÈÕ
°æȨ:1999, Richard Gooch
°æȨ:2005, Pekka Enberg
±¾ÎļþÒÔ GPLv2 Ðí¿É·¢·Å
[·Òë˵Ã÷:Richard Gooch µÄÕâ·Ý Overview of ......