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. 手工杀毒辅助软件(PC Hunter) V1.51 免费绿色版

    软件名称: 手工杀毒辅助软件(PC Hunter) 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win 32位/64位 软件大小: 4.7MB 图片预览: 软件简介: PC Hunter是 ...

  2. PortMon(电脑开放端口检查工具) 3.03 免费绿色版

    软件名称: PortMon(电脑开放端口检查工具) 3.03 免费绿色版 软件语言: 英文 授权方式: 免费软件 运行环境: Win7 / Vista / Win2003 / WinXP / Win2 ...

  3. textview设置不同字体大小

    <style name="style0"> <item name="android:textSize">19dip</item&g ...

  4. lucene Filter过滤器

    摘自:http://iamyida.iteye.com/blog/2199368 1.TermFilter:就是按照Term去过滤,跟TermQuery类似: Filter filter = new ...

  5. CSS实现三角形图标的原理《转载》

    网页中经常有一种三角形的图标,鼠标点一下会弹出一个下拉菜单之类的(之前淘宝也有,不过现在改版好像没有了) 之前以为是个png图标背景,后来在bootstrap中看到有一个图标样式叫做caret的用来实 ...

  6. PHP mktime函数获取今天的开始和结束时间戳

    php 获取今日.昨日.上周.本月的起始时间戳和结束时间戳的方法,主要使用到了 php 的时间函数 mktime(). mktime函数用法如下:mktime(hour,minute,second,m ...

  7. 如何设置linux的文件和目录的权限

    1 字符表示法 1)chmod [-R] 权限(mode)file   注:[-R]会将目录下所有权限都设置成指定的 who operator permission u(owner) +增加权限 r( ...

  8. zTree 勾选checkbox

    zTree 勾选checkbox var setting = {    check: {        enable: true//        chkboxType : { "Y&quo ...

  9. 永久修改python默认的字符编码为utf-8

    这个修改说来简单,其实不同的系统,修改起来还真不一样.下面来罗列下3中情况 首先所有修改的动作都是要创建一个叫 sitecustomize.py的文件,为什么要创建这个文件呢,是因为python在启动 ...

  10. 《Mastering Opencv ...读书笔记系列》车牌识别(II)

    http://blog.csdn.net/jinshengtao/article/details/17954427   <Mastering Opencv ...读书笔记系列>车牌识别(I ...