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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29067253/viewspace-2142731/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29067253/viewspace-2142731/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值