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中。
而块的大小在不同的操作系统上不一定是一样的。
数据在磁盘和内存之间的传输是以块的形式而不是用户需要的特定字节,存储在内存中的数据则是以页的形式来进行管理,当然,汇编指令只知道字节地址~

相关文章
|
6月前
|
Docker 容器
devmapper: Thin Pool has 162394 free data blocks which is less than minimum required 163840 free dat
devmapper: Thin Pool has 162394 free data blocks which is less than minimum required 163840 free dat
47 0
|
编解码 算法 测试技术
[译]Page Multiplexing and Ordering in a Physical Ogg Stream
Ogg容器格式的设计和排列受几个高级设计决策支配,这些决策构成了特定的低级设计决策的依据。
80 0
How to assign free areas? | Operating system principle
How to assign free areas? | Operating system principle
63 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
210 0
|
前端开发 Java 关系型数据库
记录:The field files exceeds its maximum permitted size of 1048576 bytes...【亲测有效】
记录:The field files exceeds its maximum permitted size of 1048576 bytes...【亲测有效】
1125 0
|
算法
On the Correct and Complete Enumeration of the Core Search Space
在之前的文章中我们讨论了基于graph的DP-based算法,来解决join ordering的枚举问题。 这些DP算法通过join predicate描述的连通性,解决了枚举可能的表组合问题,但join graph本身(即使hypergraph)是无法完整的描述join语义的,因为连通边本身无法描述不同类型的join语义,例如left outer join/semi join/anti join...,因此即使找到了所谓的csg-cmp-pair,也不一定是有效的plan。 这篇paper讨论的就是这个问题,当枚举出一个csg-cmp-pair (S1 o S2),如何判断这是有效的join
443 0
On the Correct and Complete Enumeration of the Core Search Space
|
算法 前端开发 弹性计算
译《Time, Clocks, and the Ordering of Events in a Distributed System》
Motivation 《Time, Clocks, and the Ordering of Events in a Distributed System》大概是在分布式领域被引用的最多的一篇Paper了。
902 0
|
存储 C++
1129 recommendation system set
Recommendation system predicts the preference that a user would give to an item.
1031 0