我的实验3:磁盘调度算法的实现.pdf
ache d)andon-timecontrolproblems;severitygreaterrisk,accordingtot herequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleopenminemanageroncoalmine productionjobdistrictwithinofse curityhiddentroubleshooting,andgovernanceandreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,andbyhi ddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreporting ofcomprehensivew ork.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacomprehensiveinspectionofequipment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefectivedevicestoincreasethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting,help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isresponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper 实验报告 学院(系)名称:计算机与通信工程学院 姓名刘子贤学号专业计算机科学与技术(中加 ) 班级2012 级 4 班实验项目实验三:磁盘调度算法的实现 课程名称操作系统课程代码 实验时间 2014 年 12 月 16 日第 5、6 节 2014 年 12 月 19 日第 1、2 节 2015 年 1 月 6 日第 5、6 节 实验地点 软件实验室7-216 软件实验室7-216 软件实验室7-216 批改意见成绩 教师签字: 实验内容: 1 本实验是模拟操作系统的磁盘寻道方式,运用磁盘访问顺序的不同来设计磁盘的调度算法。 2 实现的磁盘调度算法有FCFS,SSTF, SCAN ,CSCAN 和 NStepSCAN 算法。 3 设定开始磁道号寻道范围,依据起始扫描磁道号和最大磁道号数,随机产生要进行寻道的磁道号序 列。 4 选择磁盘调度算法,显示该算法的磁道访问顺序,计算出移动的磁道总数和平均寻道总数。 5 按算法的寻道效率进行排序,并对各算法的性能进行分析比较。 实验要求: 1详细描述实验设计思想、程序结构及各模块设计思路; 2 详细描述程序所用数据结构及算法; 3 明确给出测试用例和实验结果; 4 为增加程序可读性,在程序中进行适当注释说明; 5 认真进行实验总结,包括:设计中遇到的问题、解决方法与收获等; 6 实验报告撰写要求结构清晰、描述准确逻辑性强; 7 实验过程中,同学之间可以进行讨论互相提高,但绝对禁止抄袭。 【实验过程记录(源程序、测试用例、测试结果及心得体会等)】 源程序: ache d)andon-timecontrolproblems;severitygreaterrisk,accordingtot herequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleopenminemanageroncoalmineproductionjobdistrictwithinofse curityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,andbyhi ddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreporting ofcomprehensivew ork.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacomprehensiveinspectionofequipment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefe ctivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting, help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isresponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper #include #include void FCFS(int b,int n,int init) int i,s,sum; int a20; for(i=0;i=0;i-) s=a0; p=0; for(j=0;j=0;i-) biaoji=0; for(j=0;j=0;i-) biaoji=0; for(j=0;j0) biaoji=1; p=j; break; if(biaoji=1) s=ap; for(j=0;jki-) biaoji=0; ached)andon-timecontrolproblems;severitygreaterrisk,accordingtotherequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleope nminemanageroncoalmineproductionjobdistrictwithinofsecurityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,a ndbyhiddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreportingofcomprehensivework.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacom prehensiveinspectionofequi pment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefectivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting,help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isre sponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper第 5 页 共 9 页 for(j=0;j0) biaoji=1; p=j; break; if(biaoji=1) s=ap; for(j=0;jki-) s=a0; for(j=0;j=i;j+) if(aj-ks-k) s=aj; p=j; ap=ai; printf(“ 第%d 次访问的磁道 :%dn“,n-i,s); sum+=s-k; k=s; printf(“ 平均寻道长度 :%fn“,sum*1.0/n); ache d)andon-timecontrolproblems;severitygreaterrisk,accordingtot herequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleopenminemanageroncoalmineproductionjobdistrictwithinofse curityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,andbyhi ddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreporting ofcomprehensivew ork.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacomprehensiveinspectionofequipment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefe ctivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting, help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isresponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper void main() int a20; int i,n,k,k1,init; printf(“ 请输入需要访问的磁道总数:“); scanf(“%d“, for(i=0;in;i+) printf(“ 需要访问的磁道%d:“,i+1); scanf(“%d“, printf(“ 请输入指针所在磁道:“); scanf(“%d“, k=1; while(k) printf(“*n“); printf(“* 1.先来先服务 (FCFS) *n“); printf(“* 2.最短寻道时间优先(SSTF) *n“); printf(“* 3.扫描算法 (SCAN) *n“); printf(“* 4.循环算法 (C-SCAN) *n“); printf(“* 0.退出*n“); printf(“*n“); printf(“ 请在下面输入您的选择:“); scanf(“%d“, switch(k) case 1:FCFS(a,n,init);break; case 2:SSTF(a,n,init);break; case 3:k1=1; while(k1) printf(“*n“); printf(“* 1.移动臂由里向外*n“); printf(“* 2.移动臂由外向里*n“); printf(“* 0.返回上一层*n“); printf(“*n“); printf(“ 请在下面输入您的选择:“); scanf(“%d“, switch(k1) case 1:SCAN1(a,n,init);break; case 2:SCAN2(a,n,init);break; break; case 4:C_SCAN(a,n,init);break; ached)andon-timecontrolproblems;severitygreaterrisk,accordingtotherequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleope nminemanageroncoalmineproductionjobdistrictwithinofsecurityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,a ndbyhiddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreportingofcomprehensivework.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacom prehensiveinspectionofequi pment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefectivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting,help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isre sponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper第 7 页 共 9 页 测试截图: 1、先来先服务 2、最短寻道时间优先 ache d)andon-timecontrolproblems;severitygreaterrisk,accordingtot herequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleopenminemanageroncoalmineproductionjobdistrictwithinofse curityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,andbyhi ddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreporting ofcomprehensivew ork.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacomprehensiveinspectionofequipment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefe ctivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting, help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isresponsiblefortroubleshootingwhetherexistsSupercapacity,andSuper 3、扫描算法 (1)磁头由里向外移动 (2)磁头由外向里移动: ached)andon-timecontrolproblems;severitygreaterrisk,accordingtotherequiredtroubleshooting,registrationform,andsignedbythoseresponsibleforthese curityoftheunitforthefirstafterescalation.Thirdarticleope nminemanageroncoalmineproductionjobdistrictwithinofsecurityhiddentroubleshooting,andgovernancea ndreportfullisresponsiblefor;se curityDeputyManagertieManagerwork,theparagraphconstructionteamheadandthebusine ssdepartmentheadMember,andrunmaintenancepersonnel,areshouldaccor dingtot heirofdutiesrange,onproductionequipment,andfacilities,andsiteenvironment,aspectsofsecurityhiddenforcheckandreport,a ndbyhiddenrectifi cationprogrammeforhiddengover nance.Fourthopen-pitminesafetysectionisresponsibleforthesupervisionandinspectioni ntheproductionareatroubleshooting,managementandreportingofcomprehensivework.Articlescopeandfocusoftheinspectionpersonnelatvariouslevels:1,operatingpersonnelbeforetakingoverandshiftbeforethejurisdi ctionareatocondu ctacom prehensiveinspectionofequi pment,runningthesquadl ea erondutyduringmajore qui pmentoverhaul,beforeandaftertheshifttode signatedstafftounderstandtheoperationofequipmentinthee qui pmentandcheckonfocus.2,equi pmentrepairequipmenttoselectmaintenancecheckatleasttwiceaweektokeyequi pmentanddefectivedevicestoincrea sethefrequencyofinspection.Teamleaderde dicatedtothedeviceeverydayoperationofalldeviceswithinthescopeofmaintenancepersonnelundersta ndthemaintenanceandinspectionofkeyequipment.Paragraph3,theow nerandprofessionalandtechnicalpersonnelshoul dbecarriedoutdailyafterworksitevisitinspection.Evening.Controlroom:focusedoncoalseamspontaneouscombustionundertroubleshooting,help,landslide,coalfire,earth-movi ng,roadcarwallsitesafetysupervision,andconscientiouslyimplementtheminerectificationmeasures.Productiontechnologysection:isre sponsiblefortro