void input() { int i,N; system("CLS"); printf("\n please input the process number:N="); scanf("%d",&N); for(i=0;i<N;i++) { printf("\n the process number No.%d:\n",i); p=getpch(PCB); printf("\ninput the process name:"); scanf("%s",p->ID); printf("\n input the priority:"); scanf("%d", &p->priority); printf("\n input the process running time:") ; scanf("%d", &p->ALLtime); printf("\n input the process STARBLOCK:"); //运行阻塞时间 scanf("%d",&p->STARTBLOCK); printf("\n input the process BLOCKTIME:"); scanf("%d",&p->BLOCKTIME); printf("\n"); p->CPUtime=0; p->state='w'; p->next=NULL; sort(p); } }
void InsertList(int size,int start) { LN *p,*s,*t; p=L; t=p->next; s=getpch(LN); s->size=size; s->start=start; s->end=start + size ; s->next=t; p->next=s; if(t) t->front=s; s->front=p; }
void GetFree() { int size,start,i; L=getpch(LN); L->next=NULL; L->front=NULL; printf("请输入空闲区数:"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("请输入第%2d空闲区的大小和始址:\n",i); scanf("%d %d",&size,&start); InsertList(size,start); } printf("分配完毕!\n"); //printf("\n空闲链表情况:\n"); //PrintList(); }
input() /* 建立进程控制块函数*/ { int i,num; printf("\n 请输入进程个数:"); scanf("%d",&num); for(i=0;i<num;i++) { printf("\n 进程号No.%d:\n",i); /*输入要插入的进程的信息*/ p=getpch(PCB); printf("\n 输入进程名:"); scanf("%s",p->name); printf("\n 输入进程运行时间:"); scanf("%d",&p->ntime); printf("\n"); p->rtime=0;p->state='w'; p->link=NULL; insert(); /* 调用insert函数把输入的进程插入到队列后面*/ } }
void input() { int i,num; printf("\n 请输入进程号?"); scanf("%d",&num); for(i=0;i<num;i++) { printf("\n 进程号No.%d:\n",i); p=getpch(PCB); printf("\n 进程名:"); scanf("%s",p->name); printf("\n 进程优先数:"); scanf("%d",&p->super); printf("\n 进程运行时间:"); scanf("%d",&p->ntime); printf("\n"); p->rtime=0;p->state='w'; p->link=NULL; sort(); } }