C语言课程设计_存储管理分区分配算法/***pcb
c***/#include"stdio
h"#include"stdlib
h"#include"string
h"#defineMAX32767typedefstructnode/*设置分区描述器*/{intaddress,size;structnode*next;}RECT;/*函数原型*/RECT*assignment(RECT*head,intapplication);voidacceptment1(RECT*head,RECT*back1);voidacceptment2(RECT*head,RECT*back1);intbackcheck(RECT*head,RECT*back1);voidprint(RECT*head);/*变量声明*/RECT*head,*back,*assign1,*p;intapplication1,maxblocknum;charway;/*主函数*/main(){charchoose[10];intcheck;head=malloc(sizeof(RECT));/*建立可利用区表的初始状态*/p=malloc(sizeof(RECT));head->size=MAX;head->address=0;head->next=p;maxblocknum=1;p->size=MAX;p->address=0;p->next=NULL;print(head);/*输出可利用表初始状态*/printf("Entertheway(bestorfirst(b/f)\n");/*选择适应策略*/scanf("%c",&way);do{printf("Entertheassignoraccept(as/ac)\n");scanf("%s",choose);/*选择分配或回收*/if(strcmp(ch