#include #include #include #define NULL 0 int shumu=0; //进程的内容结构体 struct node { int a; char ch; }; //进程PCB 结构体 struct jincheng { int pid; int youxian; float luntime; float zhantime; char zhuangtai;//a 表示执行,b 表示动态就绪 node *neirong; struct jincheng *next; }; struct jincheng *neijin,*neizhi,*p,*q; //换出进程函数 void huanchu(int a) { p=neijin; while(p->pid
=NULL) { q=p; p=p->next; } if(p==NULL) { printf("该进程不在内存里
\n"); return; } if(p==neijin) { neijin=neijin->next; } else { q->next=p->next; } } //杀死正在运行进程函数 void shasi() { neizhi->next=NULL; printf("运行的进程已经杀死
\n"); return; } //创建新进程后与正在运行进程比较优先级并根据优先级判断谁该占用处理机 int bijiao() { int i,j; p=neijin; while(p
=NULL) { q=p; p=p->next; } i=q->youxian; j=neizhi->next->youxian; if(i>j) { p=neijin; if(p==q) { neijin=neizhi->next; p->neirong=(node*)malloc(si