我正在阅读 Tannenbaum 的《现代操作系统》Memory Management with Bitmaps
一书,但发现很难理解他这句话的含义
The smaller the al- location unit, the larger the bitmap. However, even with an allocation unit as small as 4 bytes, 32 bits of memory will require only 1 bit of the map.
为什么 4 个字节(32 位)的内存在映射中只占用 1 位?
最佳答案
此上下文中的位图用于指示正在分配哪些内存块。
Why will 4 bytes (32bit) of memory occupy only 1 bit in the map?
它们不占用 1 位。一口确定这 4 个字节是否正在使用。
The smaller the allocation unit, the larger the bitmap. However, even with an allocation unit as small as 4 bytes, 32 bits of memory will require only 1 bit of the map.
假设您有一个 1024 字节的内存池并且要使用此技术。如果允许分配 128 字节,则意味着位图只需要 8 位 (8*128 = 1024)。如果分配 64 字节,则位图需要 16 位。
我不得不说,这是指示已分配磁盘簇的正常且习惯的方式,我怀疑它是否占用了太多内存。
关于c - 为什么32bit的内存只需要1bit的map,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43873488/