ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:16.95KB ,
资源ID:17043982      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17043982.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(操作系统处理机调度实验报告Word文档格式.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

操作系统处理机调度实验报告Word文档格式.docx

1、 int priority; int cputime; int needtime; int count; enum state process; struct pcbb *next;typedef struct pcbb pcb;void display_menu() printf(CHOOSE THE ALGORITHM:n);1 PRIORITYn2 ROUNDROBINn3 EXITnpcb* get_process() pcb *q; pcb *p; pcb *t; int i = 0;input name and timen while (i name);%d,&q-needtime

2、); q-cputime = 0;priority = P_TIME - q-needtime;process = ready;next = NULL; if(i=0) p = q; t = q; else t-next = q; i+; return p;void free_process(pcb *p) while(p!= NULL) q = p; p = p-next; free(q);void display(pcb *p) name cputime needtime priority staten while(p) printf(,p- cputime);priority); swi

3、tch(p-process) case ready:printf(readynbreak; case execute:executen break; case block:blockn case finish:finishnint process_finish(pcb *q) int b1 = 1; while(b1&q) b1 = b1&needtime=0; q = q- return b1;void cpuexe(pcb *q) pcb *t = q; int tp = 0; while(q) if (q-process!=finish) q- if(q-needtime=0) q-pr

4、ocess = finish; if(tppriority; if(t-needtime!=0) t-priority -=3;needtime -;process = execute;cputime+;void priority_cal() p = get_process(); int cpu = 0; while(!process_finish(p) cpu+;cputime:%dn,cpu); cpuexe(p); display(p); sleep(2); free_process(p);All processes have finishednpcb *get_process_roun

5、d() while (ineedtime=1) q- elsecputime +=2;needtime -=2;needtime while ( t & t-process = finish); if(t = NULL) t = head; while(t-next!=k &process = finish) t = t- return t;void set_state(pcb *p) if(p-needtime = 0) p-process = execute) void display_round(pcb *p)name cputime needtime count statencount

6、);void round_cal() pcb *r; p = get_process_round(); r=p; if(r- cpu+=1; else cpu+=2; cpu_round(r); r = get_next(r,p); display_round(p); set_state(p);main() display_menu(); int k; scanf(k); switch(k) case 1:priority_cal(); case 2:round_cal(); case 3: default:YOU HAVE NOT CHOOSE ANY ALGORITHM!运行后结果如下:r

7、ootrhel5hbzy # gcc -o chuliji chuliji.crootrhel5hbzy # ./m1 PRIORITY2 ROUNDROBIN3 EXIT1input name and timejing 2aaaa 8bbbb5ffff4ggg 6name cputime needtime priority statejing- 1 1 45 executeaaaa* 0 8 42 readybbbb2 0 0 50 finishffff2 0 0 50 finishggg 0 6 44 readyrtyucputime:2jing* 2 0 42 execute5cputi

8、me:3jing* 2 0 42 finishggg 1 5 41 execute2cputime:4aaaa 1 7 39 executeggg 1 5 41 ready5 1 7 39 readyggg 2 4 38 execute6aaaa$ 2 6 36 executeggg 2 4 38 ready7aaaa$ 2 6 36 readyggg 3 3 35 execute8aaaa! 3 5 33 executeggg 3 3 35 ready9 3 5 33 readyggg 4 2 32 execute10aaaa 4 4 30 executeggg 4 2 32 ready11

9、aaaa 4 4 30 readyggg 5 1 29 execute12aaaa_ 5 3 27 executeggg 5 1 29 ready13aaaa_ 5 3 27 readyggg 6 0 26 execute14aaaa_ 6 2 24 executeggg 6 0 26 finish15aaaa_ 7 1 21 execute16aaaa_ 8 0 18 executeAll processes have finishedrootrhel5hbzy # rtyu2bash: rtyu2: command not foundrootrhel5hbzy # 3 3:三、分析与体会多道程序设计中,通常是若干个进程同时处于就绪状态,必须依照某种策略来决定哪个进程优先占有处理机。因而引起进程调度。本实验模拟单处理机情况下的处理机调度问题,使我加深了对进程调度的理解。通过本次试验,使我加深了对进程调度的具体细节的理解,掌握LINUX系统结构、实现处理机和各种典型的算法,系统了解了操作系统的设计和实验思路,动手能力更强了。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1