- 博客(3)
- 收藏
- 关注
原创 Linux 0.11 malloc分析
(1)通过桶的概念来管理内存,每个桶有一个容量size,想分配的内存大小和桶的容量比较,找到相对应的桶。 (2)桶内维护着一个描述符,这个描述符用来管理桶的容量,描述符中的page指向分配的一页内存,freeptr指向空闲的内存链头,refcnt为本描述符内分配出的数量。 (3)描述符占用的空间,是通过free_bucket_desc来获得。当free_bucket_desc没有的时候,通过i
2014-12-12 23:20:47 163
原创 双向链表的简单实现
#include #include struct list { struct list *prev; struct list *next; }; struct list *list_head = {NULL, NULL}; void list_init(struct list *head) { head->next = head; head->pre
2014-09-08 16:45:09 163
原创 单向链表插入实现
#include #include #include struct list { int data; struct list *next; }; struct list *list_reasch(struct list *first, int d) { struct list *p = first; while(p) { if (p->data == d) {
2014-08-31 19:47:20 218
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人