C 语言课程设计_存储管理分区分配算法 /***pcb
c***/ #include "stdio
h" #include "stdlib
h" #include "string
h" #define MAX 32767 typedef struct node /*设置分区描述器*/ { int address,size; struct node *next; }RECT; /*函数原型*/ RECT *assignment(RECT *head,int application); void acceptment1(RECT *head,RECT *back1); void acceptment2(RECT *head,RECT *back1) ; int backcheck(RECT *head,RECT *back1); void print(RECT *head); /*变量声明*/ RECT *head,*back,*assign1,*p; int application1,maxblocknum; char way; /*主函数*/ main() { char choose[10]; int check; 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("Enter the way(best or first(b/f)\n");/*选择适应策略*/ scanf("%c",&way); do{ printf(