操作系统实验10Word文件下载.docx
- 文档编号:19858952
- 上传时间:2023-01-11
- 格式:DOCX
- 页数:24
- 大小:153.53KB
操作系统实验10Word文件下载.docx
《操作系统实验10Word文件下载.docx》由会员分享,可在线阅读,更多相关《操作系统实验10Word文件下载.docx(24页珍藏版)》请在冰豆网上搜索。
练习编译、调试EOS操作系统内核以及EOS应用程序。
3.实验类型
验证
二、实验环境
OSLab
三、实验过程
3.2验证先来先服务磁盘调度算法
输入:
******Diskschedulestartworking******
StartCylinder:
10
TID:
31Cylinder:
8Offset:
2-
32Cylinder:
21Offset:
13+
33Cylinder:
9Offset:
12-
34Cylinder:
78Offset:
69+
35Cylinder:
0Offset:
78-
36Cylinder:
41Offset:
41+
37Cylinder:
10Offset:
31-
38Cylinder:
67Offset:
57+
39Cylinder:
12Offset:
55-
40Cylinder:
Totaloffset:
360Transfertimes:
10Averageoffset:
36
******Diskschedulestopworking******
41Cylinder:
42Cylinder:
43Cylinder:
44Cylinder:
45Cylinder:
46Cylinder:
47Cylinder:
48Cylinder:
49Cylinder:
50Cylinder:
51Cylinder:
52Cylinder:
53Cylinder:
54Cylinder:
55Cylinder:
56Cylinder:
57Cylinder:
58Cylinder:
59Cylinder:
60Cylinder:
3.3验证最短寻道时间优先磁盘调度算法
输出窗口:
0=
1-
4+
9+
20+
26+
11+
150Transfertimes:
15
3.4验证SSTF算法造成的线程“饥饿”现象
修改代码:
11Offset:
3+
1+
72Transfertimes:
7
3.5验证扫描磁盘调度算法
输出窗口
2+
69-
8-
146Transfertimes:
14
12+
88Transfertimes:
8
验证解决饥饿现象
138Transfertimes:
13
3.6改写SCAN算法
源代码:
BOOLScanInside=TRUE;
PREQUEST
IopDiskSchedule(
VOID
)
{
PLIST_ENTRYpListEntry;
PREQUESTpRequest;
LONGOffset;
ULONGInsideShortestDistance=0xFFFFFFFF;
ULONGOutsideShortestDistance=0xFFFFFFFF;
PREQUESTpNextRequest=NULL;
PREQUESTINpNextRequest=NULL;
PREQUESTOUTpNextRequest=NULL;
//
//需要遍历请求队列一次或两次
for(pListEntry=RequestListHead.Next;
//请求队列中的第一个请求是链表头指向的下一个请求。
pListEntry!
=&
RequestListHead;
//遍历到请求队列头时结束循环。
pListEntry=pListEntry->
Next){
//
//根据链表项获得请求的指针
pRequest=CONTAINING_RECORD(pListEntry,REQUEST,ListEntry);
//计算请求对应的线程所访问的磁道与当前磁头所在磁道的偏移(方向由正负表示)
Offset=pRequest->
Cylinder-CurrentCylinder;
if(0==Offset){
//
//如果线程要访问的磁道与当前磁头所在磁道相同,可立即返回。
pNextRequest=pRequest;
gotoRETURN;
}elseif(Offset>
0){
//记录向内移动距离最短的线程
if(Offset<
InsideShortestDistance){
InsideShortestDistance=Offset;
INpNextRequest=pRequest;
}
}elseif(Offset<
//记录向外移动距离最短的线程
if(-Offset<
OutsideShortestDistance){
OutsideShortestDistance=-Offset;
OUTpNextRequest=pRequest;
}
}
//
//如果第一次遍历没有线程访问指定方向上的磁道,就变换方向,
//进行第二次遍历。
在这两次遍历中一定能找到合适的线程。
if(ScanInside){
if(INpNextRequest)
{
returnINpNextRequest;
else
ScanInside=!
ScanInside;
returnOUTpNextRequest;
}
else
{
if(OUTpNextRequest)
}
ScanInside=!
returnINpNextRequest;
RETURN:
returnpNextRequest;
}
输出窗口:
3.7编写循环扫描磁盘调度算法
ULONGOutsideLongestDistance=0x00000000;
if(-Offset>
OutsideLongestDistance){
OutsideLongestDistance=-Offset;
1
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 操作系统 实验 10
![提示](https://static.bdocx.com/images/bang_tan.gif)