欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    实验报告材料一进程调度算法Word下载.docx

    • 资源ID:8641801       资源大小:78.94KB        全文页数:15页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    实验报告材料一进程调度算法Word下载.docx

    1、4、程序及运行结果(或实验数据记录及分析) 本次实验让我更加明白进程调度的概念,更加了解进程调度的工作原理。在前期,我是直接将结果显示出来,后来,我又在原有的基础上加了显示每一时刻队列的信息。在编写此代码过程中遇到很多问题,例如指针问题,指针指来指去,总是指错地址。具体代码:#includestdlib.h#define MAX 1000typedef struct progress int ID; /进程名 char state; /进程状态 int super; /优先数 int arrive_time; /到达时间 int serve_time; /服务时间 struct progres

    2、s *next;node;node* sortFCFS(node* head,node* q) node *p,*pre; int done=0; if(head=NULL)|(q-arrive_time)arrive_time) /*到达时间最先者,插入队首*/ q-next=head; head=q; else /* 进程比较到达时间,插入适当的位置中*/ p=head; pre=p-next; while(pre!=NULL) if(q-(pre-arrive_time) /*若插入进程比当前进程到达时间小,*/ /*插入到当前进程前面*/ q-next=pre; p-next=q; p

    3、re=NULL; done=1; else p=p- pre=pre- if(done=0) p- return head;/*函数功能:创建单链表参数:空返回值:指向节点的指针head */node* create() node *head; node *p,*q; int x,count=0; head=NULL; printf(ntt请输入进程名【输入-1结束】:); while(scanf(%d,&x)!=EOF & x!= -1) p=(node *)malloc(sizeof(node); printf(tt请输入优先级数【优先数高者优先】: scanf( %dp-super);t

    4、t请输入到达时间【到达时间不得小于0】:arrive_time);tt请输入服务时间【服务时间必须大于0】:serve_time); p-ID=x;state=w;next=NULL; head=sortFCFS(head,p); ntt请输入进程名(输入-1结束): 输出单链表指向节点的指针headvoid print(node *head) node *p;nt|-结点信息情况-|ntt| 进程名 |优先级数|到达时间|服务时间| 状态 | p=head; while(p)ntt|%8d|%8d|%8d|%8d|%8c|,p-ID,p-super,p-arrive_time,p-serve

    5、_time,p-state); p=p-nt|-结点信息情况-|n利用先来先服务调度算法 存在问题:void FCFS(node* head) int start_time,finish_time=0,round_time,all_time=0; int done=1; int clock=0; float right_round_time; node* p,*q,*flag; flag=p=head; clock=p-arrive_time; all_time=start_time=head- all_time+=p-serve_time; while(done) done=0;nnt|-第

    6、%2d 时刻-|,clock); while(p) if(p-arrive_timer) done=1; p=p- while(flag-next)flag=flag- print(head);t|-第%2d 时刻-|nn if(clock=all_time)break; clock+; finish_time=start_time+head- if(finish_time=clock) head-f flag- head=head- flag=flag- start_time=finish_time; p=head; finish_time=p-t|-FCFS调度算法-|nt| 进程名 |到

    7、达时间|服务时间|开始时间|完成时间|周转时间|带权周转| if(p-=finish_time) else start_time=p- finish_time=start_time+p- round_time=finish_time-p- right_round_time=(float)round_time/p-nt|%8d|%8d|%8d|%8d|%8d|%8d|%8.2f|ID,serve_time,start_time,finish_time,round_time,right_round_time);nt|-FCFS调度算法-|nvoid SortBySuper(node *head)

    8、node *p1,*q1,*temp; temp=(node*)malloc(sizeof(node); for(p1=head-p1!=NULL&p1-p1=p1-next) for(q1=p1-q1!q1-q1=q1- if(p1-superID=p1-ID; p1-ID=q1- q1-ID=temp- super=p1-super;super=q1-super=temp-arrive_time=p1-arrive_time=q1-arrive_time=temp-serve_time=p1-serve_time=q1-serve_time=temp-state=p1-state;stat

    9、e=q1-state=temp-利用优先数调度算法 void priority(node* head) SortBySuper(head);while(flag-nt|-优先数调度算法-|int main() char choice; dontt|-MUNE-|ntt|-1.FCFS调度算法-|ntt|-2.优先数调度算法-|nttt你的选择是:bb while(scanf( %cchoice)!=EOF&choice!=12 head=create(); switch(choice) case :print(head); FCFS(head);break; priority(head);运行结果截图:先来先服务调度算法运行结果优先级调度算法运行结果


    注意事项

    本文(实验报告材料一进程调度算法Word下载.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开