操作系统实验六_实验六实用操作系统
操作系统实验六由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“实验六实用操作系统”。
void * my_malloc(unsigned int size){
// int i;
// Linker *p=first;
// for(i=size;i
//p=p->next;
// if(i>HEAP_SIZE)//空?间?不?足Á?
//return NULL;
// if(i==HEAP_SIZE){
////p=(l.n+a)->first;
//delete p;}
// else
// {//p=(l.n+i)->first;
//int j;
////WORD *w;
//int temp;
//for(j=HEAP_SIZE;jtag=1;p->kval=a;return p;
//return NULL;
if(size>first->size)
return NULL;
else
{
static Linker* p=(struct Linker *)&heap[HEAP_SIZE-(first->size)];p->size=size;
Linker* tem=first;
while(tem!=NULL)
tem=tem->next;
tem=p;
first->size=(first->size)-size;
return tem;
}
}
void my_free(void * addr){
Linker* p,*tem;
p=first;
while((Linker*)addr->size!=p->next->size)
p=p->next;
tem=p->next;
p->next=tem->next;
first->size=first->size+tem->size;
delete tem;
}
l.insert(w,j);}