文章分类 -  工程技术

摘要:每个thread一个连接队列,conn很庞大,你可以理解它囊括了连接包含的所有信息,小宇宙。typedef struct { pthread_t thread_id; /* unique ID of this thread */ struct event_base *base; /* libeven... 阅读全文
posted @ 2014-11-13 00:38 stevinwang 阅读(176) 评论(0) 推荐(0)
摘要:slabclass是slabclass_t数组,索引有size决定。slabclass数组中slabclass_t的size按照1.25倍依次增大,当然这个是可配的,具体这个该搞成多少,我也没有做结合业务做过实验。slabclass_t中的size就是当前slab中每个块的大小,乘以perslab一... 阅读全文
posted @ 2014-11-10 23:45 stevinwang 阅读(141) 评论(0) 推荐(0)
摘要:数据结构介绍item是memcached中存储的最小单元。数据结构的话,我觉得这个代码一贴,一目了然了。typedef struct _stritem { struct _stritem *next; struct _stritem *prev; struct _stritem *... 阅读全文
posted @ 2014-11-10 17:17 stevinwang 阅读(344) 评论(0) 推荐(0)
摘要:Arrays of Length Zero这样说:Zero-length arrays are allowed in GNU C. They are very useful as the last element of a structure that is really a header for ... 阅读全文
posted @ 2014-11-10 17:03 stevinwang 阅读(275) 评论(0) 推荐(0)
摘要:从扩展思路的角度来说,一个程序员应该好好读过这样一些代码: 一个操作系统内核 一个编译器 一个解释器 一个数据库 一个 Web 服务器 一个 Web 浏览器 一个编辑器因为这些都是几十年来被频繁地反复实现的代码,无数天才的程序员在这些领域发挥智慧,所以在它们各自领... 阅读全文
posted @ 2014-11-09 20:58 stevinwang 阅读(115) 评论(0) 推荐(0)