91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 772KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-17
  • 語言: 其他
  • 標簽: 哈工大??HIT??Lab8??

資源簡介

哈工大計算機系統(tǒng)Lab8 報告+源代碼,供學弟學妹參考。

資源截圖

代碼片段和文件信息

/*
?*?mm-naive.c?-?The?fastest?least?memory-efficient?malloc?package.
?*
?*?In?this?naive?approach?a?block?is?allocated?by?simply?incrementing
?*?the?brk?pointer.??A?block?is?pure?payload.?There?are?no?headers?or
?*?footers.??Blocks?are?never?coalesced?or?reused.?Realloc?is
?*?implemented?directly?using?mm_malloc?and?mm_free.
?*
?*?NOTE?TO?STUDENTS:?Replace?this?header?comment?with?your?own?header
?*?comment?that?gives?a?high?level?description?of?your?solution.
?*/
#include?
#include?
#include?
#include?
#include?

#include?“mm.h“
#include?“memlib.h“

/*********************************************************
?*?NOTE?TO?STUDENTS:?Before?you?do?anything?else?please
?*?provide?your?team?information?in?the?following?struct.
?********************************************************/
team_t?team?=?{
????/*?Team?name?*/
????“hzj1173710108“
????/*?First?member‘s?full?name?*/
????“hzj“
????/*?First?member‘s?email?address?*/
????“@ZJ“
????/*?Second?member‘s?full?name?(leave?blank?if?none)?*/
????““
????/*?Second?member‘s?email?address?(leave?blank?if?none)?*/
????““
};

/*?single?word?(4)?or?double?word?(8)?alignment?*/
#define?ALIGNMENT?8

/*?rounds?up?to?the?nearest?multiple?of?ALIGNMENT?*/
#define?ALIGN(size)?(((size)?+?(ALIGNMENT-1))?&?~0x7)


#define?SIZE_T_SIZE?(ALIGN(sizeof(size_t)))

#define?WSIZE?4
#define?DSIZE?8???????????/*Double?word?size*/
#define?CHUNKSIZE?(1<<12)?/*the?page?size?in?bytes?is?4K*/

#define?MAX(xy)????((x)>(y)?(x):(y))

#define?PACK(sizealloc)????((size)?|?(alloc))

#define?GET(p)??(*(unsigned?int?*)(p))
#define?PUT(pval)??(*(unsigned?int?*)(p)?=?(val))

#define?GET_SIZE(p)??(GET(p)?&?~0x7)
#define?GET_ALLOC(p)????(GET(p)?&?0x1)

#define?HDRP(bp)????((char?*)(bp)-WSIZE)
#define?FTRP(bp)????((char?*)(bp)+GET_SIZE(HDRP(bp))-DSIZE)

#define?NEXT_BLKP(bp)???((char?*)(bp)+GET_SIZE(((char?*)(bp)-WSIZE)))
#define?PREV_BLKP(bp)???((char?*)(bp)-GET_SIZE(((char?*)(bp)-DSIZE)))

static?void?*extend_heap(size_t?words);
static?void?*coalesce(void?*bp);
static?void?*find_fit(size_t?size);
static?void?place(void?*bpsize_t?asize);
static?char?*heap_listp?=?0;
/*
?*?mm_init?-?initialize?the?malloc?package.
?*?The?return?value?should?be?-1?if?there?was?a?problem?in?performing?the?initialization?0?otherwise
?*/
int?mm_init(void)
{
????if((heap_listp?=?mem_sbrk(4*WSIZE))==(void?*)-1){
????????return?-1;
????}
????PUT(heap_listp0);
????PUT(heap_listp+(1*WSIZE)PACK(DSIZE1));
????PUT(heap_listp+(2*WSIZE)PACK(DSIZE1));
????PUT(heap_listp+(3*WSIZE)PACK(01));
????heap_listp?+=?(2*WSIZE);
????if(extend_heap(CHUNKSIZE/WSIZE)==NULL){
????????return?-1;
????}
????return?0;
}
static?void?*extend_heap(size_t?words){
????char?*bp;
????size_t?size;

????size?=?(words%2)???(words+1)*WSIZE?:?words*WSIZE;
????if((long)(bp=mem_sbrk(size))==(void?*)-1)
????????return?NULL;

????PUT(HDRP(bp)PACK(size0));
????PUT(FTRP(bp)PACK(size0));
????PUT(HDRP(NEXT_BLKP(bp))PACK(01));

????return?coalesce(

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????1228026??2018-12-29?20:30??1173710108?侯澤健.doc

?????文件???????6161??2018-12-29?19:32??mm.c

-----------?---------??----------?-----??----

??????????????1234187????????????????????2


評論

共有 條評論