What is the difference between page and block in operating system?

简介: What is the difference between pages and blocks? A block is the smallest unit of data that an operating system can either write to a file or read from a file.

What is the difference between pages and blocks? A block is the smallest unit of data that an operating system can either write to a file or read from a file.

What exactly is a page? Pages are used by some operating systems instead of blocks. A page is basically a virtual block. And, pages have a fixed size – 4K and 2K are the most commonly used sizes. So, the two key points to remember about pages is that they are virtual blocks and they have fixed sizes.

Why pages may be used instead of blocks Pages are used because they make processing easier when there are many storage devices, because each device may support a different block size. With pages the operating system can deal with just a fixed size page, rather than try to figure out how to deal with blocks that are all different sizes. So, pages act as sort of a middleman between operating systems and hardware drivers, which translate the pages to the appropriate blocks. But, both pages and blocks are used as a unit of data storage.

http://www.programmerinterview.com/index.php/database-sql/page-versus-block/

总结起来,也就是说,像磁盘这样的设备之所以被称为是块设备,是因为其传输数据的基本单元是Block,即使你的目标数据只是文件中的一个字符,操作系统和驱动仍然会读取整个块,将你想要的目标数据给你,块中剩余的数据则保存在一个特定的buffer/cache中。
而块的大小在不同的操作系统上不一定是一样的。
数据在磁盘和内存之间的传输是以块的形式而不是用户需要的特定字节,存储在内存中的数据则是以页的形式来进行管理,当然,汇编指令只知道字节地址~

相关文章
|
编解码 算法 测试技术
[译]Page Multiplexing and Ordering in a Physical Ogg Stream
Ogg容器格式的设计和排列受几个高级设计决策支配,这些决策构成了特定的低级设计决策的依据。
54 0
How to assign free areas? | Operating system principle
How to assign free areas? | Operating system principle
41 0
|
缓存 数据可视化
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
155 0
|
前端开发 Java 关系型数据库
记录:The field files exceeds its maximum permitted size of 1048576 bytes...【亲测有效】
记录:The field files exceeds its maximum permitted size of 1048576 bytes...【亲测有效】
1046 0
|
XML JavaScript 前端开发
|
存储 C++
1129 recommendation system set
Recommendation system predicts the preference that a user would give to an item.
998 0
|
数据库连接 数据库