OvS: data structure analysis
hmap usage:
in include/openvswitch/shash.h, we have:

at first glance, it is a hmap encapsulated in shash.
In case we forget what is a hmap:


Obviously, it is the simplist hash map linked list. The mask means the max-hash value, the n means the total number of hashed members saved in hmap. Buckets[i] all have same hash value according to mask.
When we save key-value things, first put it in a shash_node, together with hmap_node inside it, push the hmap_node to the hmap hash linked list defined inside shash. When we search for search value of a key, gen key's hash and find in the hmap inside shash, get the hmap_node, CONTAINER_OF the hmap_node is the shash_node, then shash_node->name, shash_node->data is reachable.
OvS: data structure analysis的更多相关文章
- LRU implement Data Structure analysis
三种数据结构实现的LRU对比分析: 自适应循环链表, 跳表 和 伸展树 对比发现 : 跳表比其他两个会好一些(命中率) 来自论文 Performance Analysis of LRU
- [LeetCode] All O`one Data Structure 全O(1)的数据结构
Implement a data structure supporting the following operations: Inc(Key) - Inserts a new key with va ...
- [LeetCode] Add and Search Word - Data structure design 添加和查找单词-数据结构设计
Design a data structure that supports the following two operations: void addWord(word) bool search(w ...
- [LeetCode] Two Sum III - Data structure design 两数之和之三 - 数据结构设计
Design and implement a TwoSum class. It should support the following operations:add and find. add - ...
- Finger Trees: A Simple General-purpose Data Structure
http://staff.city.ac.uk/~ross/papers/FingerTree.html Summary We present 2-3 finger trees, a function ...
- Mesh Data Structure in OpenCascade
Mesh Data Structure in OpenCascade eryar@163.com 摘要Abstract:本文对网格数据结构作简要介绍,并结合使用OpenCascade中的数据结构,将网 ...
- ✡ leetcode 170. Two Sum III - Data structure design 设计two sum模式 --------- java
Design and implement a TwoSum class. It should support the following operations: add and find. add - ...
- leetcode Add and Search Word - Data structure design
我要在这里装个逼啦 class WordDictionary(object): def __init__(self): """ initialize your data ...
- Java for LeetCode 211 Add and Search Word - Data structure design
Design a data structure that supports the following two operations: void addWord(word)bool search(wo ...
随机推荐
- 精通CSS+DIV基础总结(三)
Div+CSS可是实现简单的网页设计,对于需要添加动作,更方便的交互,Javascript给我们提供了方便:数据的存储可以利用XML使其更加方便:而对于减少页面与服务器的交互,可以利用Ajax技术,与 ...
- Linux kernel中网络设备的管理
kernel中使用net_device结构来描述网络设备,这个结构是网络驱动及接口层中最重要的结构.该结构不仅描述了接口方面的信息,还包括硬件信息,致使该结构很大很复杂.通过这个结构,内核在底层的网络 ...
- Create Table DDL sample(TSQL)
IF EXISTS (SELECT 1 FROM sysobjects o, sysusers u WHERE o.uid=u.uid AND o.name = 'Table_Name' AND u. ...
- All about Performing User-Managed Database Recovery
Automatic Recovery with SET AUTORECOVERY ======================================== Issuing SET AUTORE ...
- 使用docker搭建kafka环境
Requirements 最近学习了下kafka,为方便搭建环境,使用docker进行部署. 需要首先安装docker的环境.要求操作系统是linux的64位系统. docker的安装(适于rpm/d ...
- [ios-必看] IOS调试技巧:当程序崩溃的时候怎么办 iphone IOS
from:http://article.ityran.com/archives/1143 有这样一种情形:当我们正在快乐的致力于我们的app时,并且什么看都是无比顺利,但是突然,坑爹啊,它崩溃了.(悲 ...
- crontab 定时的陷阱
crontab 任务不执行,首先要查询一下cron任务的宿主和语法: (1). /etc/cron.d/cron_zengtai 这个文件必须是 root:root 否则cron_zengta ...
- C#23种开发模式,陆续完善中
#region 单例模式 #region 线程非安全单例模式 public class Singleton1 { private Singleton1() { } private static Sin ...
- 校门外的树 OpenJudge 1.6.06
06:校门外的树 总时间限制: 1000ms 内存限制: 65536kB 描述 某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米.我们可以把马路看成一个数轴,马路的一端在数轴0 ...
- PRML 第二章mindmap
PRML第二章的Mindmap,这一章读的比较快,主要是很多计算和证明的过程都跳过了,感觉不是特别需要认真去看每一个公式,能够记住每个小节的结论.公式就可以了.当然有能力.有时间的人还是可以认真读的, ...