linux下进程调度模拟程序,进程调度算法在Linux下的模拟实现

{ printf("\n the number of process No.%d:\n",i);

p=getpch(PCB);

printf("\n enter the name of process:");

scanf("%s",p->name);

printf("\n enter the prior number of process:");

scanf("%d",&p->super);

printf("\n the time of process:");

scanf("%d",&p->ntime); printf("\n");

p->rtime=0;p->state='w'; p->link=NULL; sort(); } }

int space()

{ int l=0; PCB* pr=ready;

while(pr!=NULL)

{ l++; pr=pr->link; } return(l); }

disp(PCB * pr) /*建立进程显示函数,用于显示当前进程*/

{ printf("\n qname \t state \t super \t ndtime \t runtime \n");

printf("|%s\t",pr->name);

printf("|%c\t",pr->state);

printf("|%d\t",pr->super);

printf("|%d\t",pr->ntime);

printf("|%d\t",pr->rtime);

printf("\n"); }

check() /* 建立进程查看函数 */

{ PCB* pr;

printf("\n **** the running process is:%s",p->name); /*显示当前运行进程*/ disp(p); pr=ready;

printf("\n ****the ready queue is:\n"); /*显示就绪队列状态*/

while(pr!=NULL)

{ disp(pr); pr=pr->link; } }

destroy() /*建立进程撤消函数(进程运行结束,撤消进程)*/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值