没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Just like RAM, hard drives provide us with a contiguous stretch of memory
where we can store information.
Information in RAM is byte-addressable: even if you’re only trying to store a boolean (1
bit), you need to read an entire byte (8 bits) to retrieve that boolean from memory,
and if you want to flip the boolean, you need to write the entire byte back to memory.
A similar concept exists in the world of hard drives. Hard drives are divided into
sectors (we'll assume 512 bytes), and are sector-addressable: you must read or write
entire sectors, even if you’re only interested in a portion of each.
Sectors are often 512 bytes in size, but not always. The size is determined by the
physical drive and might be 1024 or 2048 bytes, or even some larger power of two if
the drive is optimized to store a small number of large files (e.g. high definition videos
for youtube.com)
Conceptually, a hard drive might be viewed like this:
Lecture 03: Layering, Naming, and Filesystem Design
Thanks to Ryan Eberhardt for the illustraons and the text used in these slides, and to Ryan and Jerry Cain for the
content.
2
The drive itself exports an API—a hardware API—that allows us to read a sector into
main memory, or update an entire sector with a new payload.
In the interest of simplicity, speed, and reliability, the API is intentionally small,
and might export a hardware equivalent of the C++ class presented right below.
This is what the hardware presents us with, and this small amount is all you really
need to know in order to start designing basic filesystems. As filesystem designers,
we need to figure out a way to take this primitive system and use it to store a user’s
files.
Lecture 03: Layering, Naming, and Filesystem Design
1 class Drive {
2 public:
3 size_t getNumSectors() const;
4 void readSector(size_t num, unsigned char data[]) const;
5void writeSector(size_t num, const unsigned char data[]);
6 };
3
Throughout the lecture, you may hear me use the term block instead of sector.
Sectors are the physical storage units on the hard drive.
The filesystem, however, generally frames its operations in terms of blocks
(which are each comprised of one or more sectors).
If the filesystem goes with a block size of 1024, then when it accesses the
filesystem, it will only read or write from the disk in 1024-byte chunks. Reading
one block—which can be thought of as a software abstraction over sectors—would
be framed in terms of two neighboring sector reads.
If the block abstraction defines the block size to be the same as the sector size
(as the Unix v6 filesystem discussed in the textbook does), then the terms
blocks and sectors can be used interchangeably (and the rest of this slide
deck will do precisely that).
Lecture 03: Layering, Naming, and Filesystem Design
4
Lecture 03: Layering, Naming, and Filesystem Design
The diagram below shows how raw hardware could be leveraged to support
filesystems as we're familiar with them. There's a lot going on in the diagram below,
so we'll use the next several slides to dissect it and dig into the details.
5
剩余23页未读,继续阅读
资源评论
梦想SEer
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2024年五一数学建模ABC题思路+代码+论文资料汇总贴.txt
- jquery-3.1.1.min.js
- 使用 Python 和 Pygame 开发《星露谷物语》 游戏+源码(毕业设计&课程设计&项目开发)
- VOC4-123-1-321-32-1
- 基于python开发的踢足球游戏+源码(毕业设计&课程设计&项目开发)
- 【课程设计全套资料】一个基于JAVA-JSP企业合同管理系统
- bootstrap的css和js文件
- lda代码-checkpoint-checkpoint.ipynb
- 基于java局域网飞鸽传书软件设计与实现(源代码+论文).zip
- 基于python开发的魂斗罗游戏+源码(毕业设计&课程设计&项目开发)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功