Use of red/black trees in Linux Kernel

Source: Internet
Author: User
Use of the red and black trees in the Linux kernel-general Linux technology-Linux programming and kernel information. The following is a detailed description. Recently, we need to use the red/black tree. When we look for information on the Internet, we accidentally find that there is a red/black tree implementation in the Linux kernel, and its code is very independent. Now we extract it. I have extracted the kernel from 2.6.24 and divided it into two files: rbtree. h and rbtree. c, rbtree. h is located in the include/linux directory of the kernel source code, rbtree. c is located in the lib directory of the kernel source code.

Delete the # include and # include rows in rbtree. h, and add the # include

For the rb_node declaration, delete the last _ attribute _ (aligned (sizeof (long ))))

Add the following macro definitions in rbtree. h:
QUOTE:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.