This file includes 4 data-structures..

Insteresting because they are written in 1994.. to make it easier using the structures..

LIST:

the common usage of the structures is to create a structure containing the list-entry as manage-tools of its pointers, this structure might contain prev|next pointers.

Then to create a header of the specific data-structure.. this header contains only 1 pointer pointing to the first struct of the data-structure..

then the pointed struct's next pointer is pointing to the next struct of the list, or null, the prev pointer is pointing to the previous pointer's address.

so this kind of design has its problem: cannot know if it's the first struct of this structure, even do not know if it has a prev pointer.. and actually cannot traverse backward..

As i forseen, this kind of design can back-traverse, but in other way like using methods like container_of(le_prev,type). though no macros in queue.h can do this. As the document says, it's a list may only be traversed in forward direction. and that is the difference between List & TailQueue.

this doubly linked list has its fast insertion in the middle of the list, if buildt a hash table for all the **prev address and their entries. O(1).

the usages:

List is used in places need to insert and delete everywhere frequently, but without quick addition/removement at tail ( because no pointer in the head struct pointing to the tail, and that's why it cannot be backward-traversed).

S(inglyLinked)list is used in places need to insert and delete from head frequently, it maynot be inserted/deleted from middle/tail.

S(inglyLinked)tailqueue is used in places need to insert after any element, delete head or any named element(O(n)), get the last element, insert after the last item quickly, this datastruct accelerates things to be done at the tail.

S(imple)queue is ued in places which is identically as S(inglyLinked)tailqueue..

Tailqueue is used to insert at head/tail quickly, before/after any element, delete any given item(O(1)). Traverse in either direction.

CircleQueue is used to insert/delete anywhere, insert/delete head/tail items are quicklier, tail & head are linked as previous/post element one another.

Learning BSD.sys/queue.h的更多相关文章

  1. [C++]Linux之头文件sys/types.h[/usr/include/sys]

    1.查找<sys/types.h>文件 一般地,Linux的C头文件<sys/types.h>路径在如题的途径:/usr/include/sys下,然而博主[Linux For ...

  2. Linux queue.h之TAILQ队列分析

    转自 这两天想看看memcached的实现,所以先学习了libevent,使用起来还是比较简单的,其实是对select/poll/kqueue等的封装,学习libevent过程中又遇到了linux下队 ...

  3. sys/types.h fcntl.h unistd.h sys/stat.h

    sys/types.h 是Unix/Linux系统的基本系统数据类型的头文件,含有size_t,time_t,pid_t等类型. 在应用程序源文件中包含 <sys/types.h> 以访问 ...

  4. /usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’

    /usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’/usr/include/linux/types.h:13: erro ...

  5. [百科]sys/types.h

    sys/types.h中文名称为基本系统数据类型.在应用程序源文件中包含 <sys/types.h> 以访问 _LP64 和 _ILP32 的定义.此头文件还包含适当时应使用的多个基本派生 ...

  6. #include <sys/stat.h>的作用

    #include <sys/stat.h> 文件状态, 是unix/linux系统定义文件状态所在的伪标准头文件. 含有类型与函数: dev_t     st_dev     Device ...

  7. sys/time.h 和 time.h

    今天在燕麦工作第二天.看荣哥给我的程序,发现程序里面用的延时跟我以前使用的不同.导入两个头文件,然后用函数来获得时间.关于这个函数特别查来一下. time.h  是ISO C99 标准日期头文件. s ...

  8. #include <sys/epoll.h> epoll - I/O event notification facility 服务器端 epoll(7) - Linux manual page http://www.man7.org/linux/man-pages/man7/epoll.7.html

    epoll使用详解(精髓) - Boblim - 博客园 https://www.cnblogs.com/fnlingnzb-learner/p/5835573.html epoll使用详解(精髓) ...

  9. [opencv3.2cmake error ] sys/videoio.h no such file or directories

    I don't have /usr/include/sys/videoio.h at all Before that , I have ipp download question. So I down ...

随机推荐

  1. MongoDB1: 环境安装

    1. 环境准备,不支持XP系统,需要在Windows7及以上和windows server 2008 系统上安装. 2. 下载安装包:http://www.mongodb.org/downloads, ...

  2. 用 monitorix 开启linux图形化监控

    # yum install monitorix # service monitorix starthttp://host:8080/monitorix/

  3. selenium1,selenium2,watir的比较

    接触web方面的自动化测试,会接触几个常用的工具,selenium1,selenium2,watir 有的时候总是混淆,那么他们的优缺点啥的呢,在让你给项目选自动化框架,会选择哪个??? 1,语言的支 ...

  4. 安装eclipse要和JDK的位数相对应

    即JDK是32位时,eclipse也要装32位的

  5. 设计模式 -- 责任链模式或者叫职责链模式(Chain of Responsibility(CoR))

    什么是链?前后相连,一个连接下一个,其中包括多个节点,其实责任链模式也类似,他是多个对象之间相互关联,下一个对象的操作由上一个对象关联下来,上一个对象有个方法用于指向其他对象.职责链之间的前后关系是可 ...

  6. 计算机网络课程优秀备考PPT之第三章数据链路层(三)

    为了记录自己从2016.9~2017.1的<计算机网络>助教生涯,也为了及时梳理和整写笔记! 前期博客是, 计算机网络课程优秀备考PPT之第一章概述(一) 计算机网络课程优秀备考PPT之第 ...

  7. 说说SACC2016第八届架构师大会

    每年这方面的会议很多,不知不觉已经连续举办八年了.一届比一届办的有质量,规模越大.今年也如约而至.2016-10-27在北京万达索菲特酒店.4000多人规模,云集各领域顶尖架构师,运维,云计算,技术专 ...

  8. Apache Kafka开发入门指南(1)

    Apache Kafka可以帮助你解决在发布/订阅架构中遇到消费数百万消息的问题.如今,商业应用.社交应用以及其它类型的应用产生的实时信息在不断增长,这些信息需要以简单的方式快速.可靠地路由到各种类型 ...

  9. html 超链接(a)详细讲解

    a:link : http://www.cnblogs.com/yangfeng/archive/2009/07/25/1530962.html 超级链接 超级链接是网站中使用比较频繁的HTML元素, ...

  10. Spring Security(06)——AuthenticationProvider

    目录 1.1     用户信息从数据库获取 1.1.1    使用jdbc-user-service获取 1.1.2    直接使用JdbcDaoImpl 1.2     PasswordEncode ...