这个lab要求我们实现一个内存分配器,其实就是要求我们对于heap区域进行高效地管理。 对于implicit和explicit实现感兴趣的同学可以实现一下看一下结果,实际上是不如segregated list的。因此,这里我们直接采用Segregated Free List实现。 Segregated List的想法就是将List中的free block按照大小进行划分。参考下图,一个Array存...
1. Malloc Lab 的要求和背景信息 1.1 Required Functions 1.2 评分标准 2. Malloc Lab 设计思路 2.1 Implicit Free List 隐式空闲列表 2.2 Explicit Free LIst 显式空闲列表 2.3 Segregated Free List 分离式空闲列表 2.4 Other data structure 其它数据结构 3. Optimization Guide 优化指北 3.1 Add Boundary Tag...
分离的空闲链表(Segregated Free Lists):维护多个空闲链表,其中每个链表中的块有大致相等的大小。分为三种: 简单分离存储(simple segregated storage):每个大小类的空闲链表包含大小相等的块,每个块的大小就是这个大小类中最大元素的大小,从不合并与分离。 分离适配(Segregated Fit):分配器维护着一个空闲链表的数组。...
最后两个用例效果不好, 可以观察到两个用例都是先将一整块(512), 分成两部分malloc(64+448), 最后将一部分free(448), 然后请求分配一整块(512), 对于我的实现, 不重新利用free掉的内存, 从而内存利用率下降. 一个比较好的方案是Segregated Free List, 将不同大小的块分别放在不同的空闲链表中, 比如当请求...
*/ int mm_init(void){ if((heap_listp = mem_sbrk(4*WSIZE)) == (void*)-1) //申请4字空间 return -1; PUT(heap_listp, 0); //填充块 PUT(heap_listp+1*WSIZE, PACK(DSIZE, 1)); //序言块头部 PUT(heap_listp+2*WSIZE, PACK(DSIZE, 1)); //序言块脚部 PUT(heap_listp+3*...
具体而言,假设我的 segregated free list 创建了 12 条链表,第 1 条链表中保存 block size ≤ 16 的 block,第 2 条链表中保存 block size ≤ 32 的区块,… 当我们 malloc(72) 的时候,我们就会先从第 4 条链表(保存 size ≤ 128 的区块)开始搜索,如果没有搜到合适的链表,我们就接着搜索第 5 条,…...
throughput. You can achieve the required throughput by converting to an explicit-list allocator, and then converting that into a segregated free list allocator. Both of these changes will not affect your utilization much. You will want to experiment with allocation policies. The provided code implem...
throughput. You can achieve the required throughput by converting to an explicit-list allocator, and then converting that into a segregated free list allocator. Both of these changes will not affect your utilization much. You will want to experiment with allocation policies. The provided code implem...
mm-2(explicit free list + FIFO).c mm-3(segregated fit + best fit+improve mm_realloc).c mm.c mm.h short1-bal.rep short2-bal.rep traces amptjp-bal.rep binary-bal.rep binary2-bal.rep cccp-bal.rep coalescing-bal.rep cp-decl-bal.rep ...
points on throughput for the checkpoint. Make sure you submit to Autolab to assess the performance of your code. Throughput measurements differ between the Shark machines and Autolab. Segregated lists If your code is modular enough, updating your explicit list to segregated lists should not ...