欢迎来到天天文库
浏览记录
ID:47710325
大小:268.50 KB
页数:6页
时间:2019-10-30
《实验3:磁盘调度》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验报告学院(系)名称:计算机与通信工程学院姓名学号专业计算机科学与技术班级2009级3班实验项目实验三:磁盘调度算法的实现课程名称操作系统课程代码0668036实验时间2011-12-121-2节2011-12-153-4节2011-12-191-2节实验地点主校区7-215批改意见成绩教师签字:实验内容:1.设定开始磁道号寻道范围,依据起始扫描磁道号和最大磁道号数,随机产生要进行寻道的磁道号序列。2.3.磁道访问序列不小于6。4.选择磁盘调度算法,显示该算法的磁道访问顺序,计算出移动的磁道总数和平均寻道总数。5.可选的实现磁盘调度算法有FCFS,SSTF,
2、SCAN,CSCAN和NStepSCAN算法。6.选择比较的算法,不小于3。7.按算法的寻道效率进行排序,并对各算法的性能进行分析比较。实验要求:1.详细描述实验设计思想、程序结构及各模块设计思路;2.详细描述程序所用数据结构及算法;3.明确给出测试用例和实验结果;4.为增加程序可读性,在程序中进行适当注释说明;5.认真进行实验总结,包括:设计中遇到的问题、解决方法与收获等;6.实验报告撰写要求结构清晰、描述准确逻辑性强;7.实验过程中,同学之间可以进行讨论互相提高,但绝对禁止抄袭。第6页共6页代码:usingSystem;usingSystem.Collec
3、tions.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceHDD{publicpartialclassHDD:Form{int[]DriveChanel=newint[10];int[]DriveChanel_store=newint[10];publicHDD(){InitializeComponent();init();}p
4、ublicvoidinit(){Randomrnd=newRandom();Stringstr=null;for(inti=0;i<10;i++){intChanel=rnd.Next(99)+1;str+="Number:"+i+",Chanel:"+Chanel+"";DriveChanel[i]=Chanel;DriveChanel_store[i]=Chanel;label_inform.Text=str;}}publicvoidreset(){for(inti=0;i<10;i++){DriveChanel[i]=DriveChanel_stor
5、e[i];}}第6页共6页privatevoidbtn_FCFS_Click(objectsender,EventArgse){reset();label_result.Text="";inttotal_distance=0;intdistance=0;intave_distance=0;for(inti=0;i<9;i++){distance=Math.Abs(DriveChanel[i]-DriveChanel[i+1]);total_distance+=distance;}ave_distance=total_distance/10;label_resu
6、lt.Text="FCFS==总寻道数:"+total_distance+",平均寻道数:"+ave_distance;}privatevoidbtn_SSTF_Click(objectsender,EventArgse){reset();label_result.Text="";stringprint=null;inttotal_distance=0;intdistance=0;intave_distance=0;inttemp_distance=0;intcurrent=0;intj=0;for(inti=0;i<10;i++){intnumber=cur
7、rent;distance=999999;for(j=0;j<10;j++){if(DriveChanel[j]==0)continue;temp_distance=Math.Abs(DriveChanel[j]-DriveChanel[number]);if(temp_distance8、istance+"";label_
8、istance+"";label_
此文档下载收益归作者所有