博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Nachos File System
阅读量:6703 次
发布时间:2019-06-25

本文共 4160 字,大约阅读时间需要 13 分钟。

hot3.png

 

Laboratory 4: Nachos File System

:Objectives(实验目标)

The purpose of this laboratory session is to study the functionality of the file system in Nachos.

The file system in Nachos is designed to be small and simple so that you can read all its source

code in a short period of time. Before starting to read the code, it is very useful to get an idea

of what functionality the Nachos file system offers. In this laboratory session, you will run the

commands of the Nachos file system and watch the effects on the simulated hard disk in Nachos.

On the completion of this laboratory session, you should know

_ what is the functionality of the Nachos file system, and

_ how to examine the contents of the simulated hard disk in Nachos.

:实验环境

It is very simple to compile Nachos with its file system. You simply move to the directory ../filesys

and execute command make. A new version of Nachos with its file system included will be

made in the directory. The Makefile in ../filesys/ includes both Makefile.local files from

../threads/ and ../filesys/. The Makefile.local in ../filesys/ is as follows:

ifndef MAKEFILE_FILESYS_LOCAL

define MAKEFILE_FILESYS_LOCAL

yes

endef

# Add new sourcefiles here.

CCFILES +=bitmap.cc\

directory.cc\

filehdr.cc\

filesys.cc\

fstest.cc\

openfile.cc\

29

synchdisk.cc\

disk.cc

ifdef MAKEFILE_USERPROG_LOCAL

DEFINES := $(DEFINES:FILESYS_STUB=FILESYS)

else

INCPATH += -I../userprog -I../filesys

DEFINES += -DFILESYS_NEEDED -DFILESYS

endif

endif # MAKEFILE_FILESYS_LOCAL

This means that this version of Nachos uses C++ files listed above in addition to the files used to

compile the Nachos in ../threads/. Most of these additional files exist in the current directory.

Some of them are in other directories such as ../userprog/. The make utility program will find

them automatically due to the VPATH defined in ../Makefile.common.

:关键代码注释:

9.5.1 Compiling Nachos File System

Follow the description in Section 9.2 to compile the Nachos with its file system in ../filesys/). 输入make

9.5.2 Testing Nachos File System

Execute the following commands and check the results as described:

(a) Execute nachos -f. Nachos should have created the simulated hard disk called DISK in your

current directory.

(b) Execute nachos -D to dump the whole file system on the simulated hard disk DISK and you

should have the following dump:

....

FileHeader contents. File size: 128. File blocks:

2

File contents:

\1f\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

31

\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0

Directory file header:

FileHeader contents. File size: 200. File blocks:

3 4

File contents:

\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\0\0\0\0\0\0\0\0

(c) Execute od -c DISK and you should have the following dump on the screen:

0000000 211 g E 200 \0 \0 \0 001 \0 \0 \0 002 \0 \0 \0

0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0

*

0000200 \0 \0 \0 \0 \0 \0 \0 002 \0 \0 \0 003 \0 \0 \0

0000220 004 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0

0000240 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0

*

0000400 \0 \0 \0 \0 037 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0

0000420 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0

(d) Execute nachos -cp test/small small to copy file small into the Nachos file system.

Use nachos -l, nachos -p and nachos -D to make sure you do create a new file named

small in the Nachos file system. Watch the dump of od -c DISK again to see what has been

changed.

(e) Continue the experiment with other nachos commands such as nachos -r on more files.

四:调试记录:

记录如上.

:运行结果分析:

本实验主要通过对文件系统的一系列操作来观察相应的nachos文件的变化,同时熟悉nachos文件的相应代表意义,就像上面的结果,可以观察到头文件和相应文件存放的扇区。

转载于:https://my.oschina.net/yanjianhai/blog/178635

你可能感兴趣的文章
NuGet学习笔记(1) 初识NuGet及快速安装使用
查看>>
PHP笔试题——遍历文件目录
查看>>
Asp.net和C# 函数方法 (2)【转载】
查看>>
百度分享代码(备用)
查看>>
SqlMapConfig.xml 配置
查看>>
wget用法详解
查看>>
在多个线程中避免和发现伪共享
查看>>
[Ubuntu] Ubuntu如何查看cronjob
查看>>
session监听
查看>>
Android Studio更新升级方法
查看>>
virtualbox主机与虚拟机互访,虚拟机上网
查看>>
ios相关手册、图表等综合
查看>>
SharpZipLib 文件/文件夹压缩
查看>>
百分比定位加position定位的常用布局
查看>>
Codeforces Round #257 (Div. 2/A)/Codeforces450A_Jzzhu and Children
查看>>
android 拍照注意问题
查看>>
form中的button按钮在IE11中自动提交表单问题导致弹出框关闭之后表单被重置
查看>>
在多个游戏视图间切换环境准备
查看>>
Linux命令-权限管理命令:chown
查看>>
第三方推送-使用推
查看>>