教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 学前教育 >

山大操作系统课程设计报告(全套)(11)

来源:网络收集 时间:2026-05-20
导读: is is the spring of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring ofng of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring of our disconteno

is is the spring of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring ofng of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring of our discontenontent.\\aThis is the spring of our discontent.\\aThis is the spring of our discontent.\\aThis is ths the spring of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring of ourf our discontent.\\aThis is the spring of our discontent.\\aThis is the spring of our discontent.\\ant.\\aThis is the spring of our discontent.\\aThis is the spring of our discontent.\\aThis is the spe spring of our discontent.\\aThis is the spring of our discontent.\\aThis is the spring of our disr discontent.\\aThis is the spring of our discontent.\\aThis is the spring of our discontent.\\aThis\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\

No threads ready or runnable, and no pending interrupts. Assuming the program completed. Machine halting!

Ticks: total 82200, idle 79780, system 2420, user 0 Disk I/O: reads 73, writes 0 Console I/O: reads 0, writes 0 Paging: faults 0

Network I/O: packets received 0, sent 0

Cleaning up... 结果分析:

Directory contents: Name: big, Sector: 5

FileHeader contents. File size: 7790. File blocks:

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

原有的nachos 系统中,一个索引节点,一个扇区的大小事128byte,所以,可以保存32个int类型的元素。

其中dataSectors数组最多有30个元素,改为二级索引时,最多有29个有效的元素,加上第二个索引的扇区一共可以有效指向文件的扇区最多有29+32=61个,

这个Name:big的文件所有占有的最多的扇区数目也就是,34-5+67-35=61 ,符合。 说明实现了二级索引节点的文件系统。

(实验目录:/csc2404/nachos-3.4/code/filesys2nodehdr)

结论分析与体会:

本次实验通过完成使Nachos文件系统创建较大的文件,将”文件头”扩大到两个扇区,也就是实现二级索引, 进一步了解了文件系统里面的概念以及实现细节的部分。深刻的理解了对于索引式的文件存储管理方式中, 文件在磁盘上的扇区号如何在索引节点中保存,索引节点空间如何扩大成为使用两个扇区的索引等问题。 同时,注意了对磁盘操作时需要写回磁盘中的操作。

返回

计算机科学与技术学院实验报告:11

实验题目:用户空间的虚拟内存管理 日期:2010-11-20 实验目的: 在原有的Nachos内存管理基础上实现虚拟内存管理,从而可以运行更大的noff格式的文件 硬件环境:

软件环境:

Linux,Nachos,Mips

实验步骤:

1, 理解实现虚拟内存的原理方法,参考Homework3 VirtualMemory.mht文件。

实现虚拟内存的内存管理方式,首先,为了简单方便,不涉及增加更多数据结构,选择了

为每一个进程分配一个Swap的文件,保存在磁盘中,即相当于交换区。这样每一个进程的Addresspace只需 保存它的swap文件即可,swap文件的内容与虚拟页一一对应,可以通过虚拟页号之间访问相应位置,

因而,当指令中需要的虚拟页在内存中不存在时,就可以直接到是swap文件相应位置读入内存的Frame中。 这样做,可以不用创建一个新的map来影射一个进程的虚拟页和在交换区的扇区号,在查找时也可以方便; 但是这样做就不能充分的利用磁盘空间,只能实现局部的页面置换(即在同一个进程之中的, 而不能实现全局页面置换)

2, 使用按需分页方法,首先为设定为每一个进程初始化分配的内存空间,也就是最小分配的空间,设为6; 一个进程可以拥有的最大的内存空间,设为25,用来判断这个进程可以使用内存的最大frame数;

分别定义在初始化的时候,数据段分配2个frame,代码段分配12个frame,userstack分配1个frame。

所以,需要在AddrSpace类定义中,怎么加两个属性,以保存虚拟内存的名字以及已经使用的内存帧数;

3, 修改原有的进程初始化分配内存空间的方法,也就是AddrSpace的构造函数。

首先为代码段分配最小的内存空间,用bitmapt的find方法找到frame,填入页表项。然后分配堆栈段 1frame的空间。将其余页表项的physicalpage设为-1,也就是不分配内存;

然后将可执行文件的相应内容到内存空间,并把可执行文件的代码,初始化数据段都载入到swap文件中, 便于在页错误时候访问。

代码如下:

AddrSpace::AddrSpace(OpenFile *executable) { NoffHeader noffH; unsigned int i,size,size1,check,count1; OpenFile* execFile; char*buffer; executable->ReadAt((char *)&noffH, sizeof(noffH), 0); if ((noffH.noffMagic != NOFFMAGIC)&&(WordToHost(noffH.noffMagic) == NOFFMAGIC)) SwapHeader(&noffH); ASSERT(noffH.noffMagic == NOFFMAGIC); printf(\ printf(\ printf(\ printf(\ size = divRoundUp(noffH.code.size,PageSize) * PageSize + divRoundUp(noffH.initData.size, PageSize)+ UserStackSize; numPages = divRoundUp(size, PageSize); size = numPages * PageSize; printf(\ extern BitMap *Mmbmp; if(numPages …… 此处隐藏:2048字,全部文档内容请下载后查看。喜欢就下载吧 ……

山大操作系统课程设计报告(全套)(11).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/598633.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)