网站大量收购独家精品文档,联系QQ:2885784924

进程调度c语言版.doc

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
进程调度c语言版

#include stdio.h #include stdlib.h #include STDLIB.H #include string.h #include CONIO.H #define null 0 #define ready 0 #define run 1 struct pcb { char name[10]; int prionity; char state; int needtime; int runtime; struct pcb*next; }*pcb; struct pcb *creatlist(int n); void dy(struct pcb *la); void sl(struct pcb *la); void sjf(struct pcb *la); struct pcb *copylist(struct pcb *la); void main() { struct pcb* la; int n,flag=1,i=1,m; printf(......0......tuichu....................\n); printf(......1......chuangjianjincheng........\n); printf(......2......duanzuoye.................\n); printf(......3......dongtai...................\n); printf(......4......lunzhuang.................\n); while(i==1) { flag=1; while(flag==1) { printf(\nxuanzecaozuo:\n); scanf(%d,n); if(n=0n=4) flag=0; else printf(\nshurucuowu.); } switch(n) { case 0:i=0;break; case 1: printf(\njinchengchangdu:); scanf(%d,m); la=creatlist(m); break; case 2: sjf(la); break; case 3: dy(la); break; case 4: sl(la); break; } } } struct pcb *creatlist(int m) {struct pcb *p; int i; struct pcb* la=(struct pcb*)malloc(sizeof(struct pcb)); la-next=null; for(i=0;im;i++) { p=(struct pcb*)malloc(sizeof(struct pcb)); printf(\nname:); scanf(%s,p-name); printf(\nneeddtime:); scanf(%d,(p-needtime)); p-runtime=0; printf(\nruntime:%d\n,p-runtime); printf(\nprionity:); scanf(%d,(p-prionity)); p-state=ready; printf(\nstate:%c\n,p-state); p-next=null; p-next=la-next; la-next=p; } printf(\n create pcb ok!); return(la); } struct pcb *copylist(struct pcb *la) { struct pcb *p,*s,*lb; int i; p=la-next; lb=(struct pcb*)malloc(sizeof(struct pcb)); lb-next=null; while(p!=null) { s=(struct pcb*)malloc(sizeof(struct pcb)); strcpy(s-name,p-name); s-needtime=p-needtime; s-runtime=p-runtime; s-prionity=p-prionity; s-state=p-state; s-next=null; s-next=lb-next; lb-next=s; p=p-next; } return(lb); } void sjf(struct pcb *la) { struct pcb *p,*q,*r,*a; struct pc

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档