Computer Systems A Programmer's Perspective Second Edition

Many computer systems place restrictions on the allowable addresses for the

primitive data types, requiring that the address for some type of object must be a
multiple of some value K (typically 2, 4, or 8). Such alignment restrictions simplify
the design of the hardware forming the interface between the processor and the
memory system. For example, suppose a processor always fetches 8 bytes from
memory with an address that must be a multiple of 8. If we can guarantee that any
double will be aligned to have its address be a multiple of 8, then the value can
be read or written with a single memory operation.Otherwise, we may need to 
perform two memory accesses, since the object might be split across two 8-byte

memory blocks.
 
Linux follows an alignment policy where 2-byte data types (e.g.,

short) must have an address that is a multiple of 2, while any larger data types
(e.g.,int,int *,float, and double) must have an address that is a multiple of 4.
Note that this requirement means that the least significant bit of the address of
an object of type short must equal zero. Similarly, any object of type int, or any
pointer, must be at an address having the low-order 2 bits equal to zero.
 
Microsoft Windows imposes a stronger alignment requirement—any primitive object of

K bytes, for K=2, 4, or 8, must have an address that is a multiple of K. In particular,
it requires that the address of a double or a long long be a multiple of 8. This
requirement enhances the memory performance at the expense of some wasted space.
The Linux convention, where 8-byte values are aligned on 4-byte boundaries was probably
good for the i386, back when memory was scarce and memory interfaces were
only 4 bytes wide. With modern processors, Microsoft’s alignment is a better design decision.
Data type long double, for which gcc generates IA32 code allocating 12 bytes (even though
the actual data type requires only 10 bytes) has a 4-byte alignment requirement with
both Windows and Linux.

simplify the design of the hardware forming the interface between the processor and thememory system的更多相关文章

  1. Full exploitation of a cluster hardware configuration requires some enhancements to a single-system operating system.

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION Operating System Desi ...

  2. ZYNQ block design警告:[BD 41-968] AXI interface port /axi_lite4 is not associated to any clock port. It may not work correctly.

    前言 在Block design中引出AXI接口给外部,检查设计告警如下: [BD 41-968] AXI interface port /axi_lite4 is not associated to ...

  3. VC++获取计算机Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information)

    转载:http://blog.csdn.net/yapingxin/article/details/50107799 转载:http://zhidao.baidu.com/link?url=A5K6N ...

  4. 【转】【翻】Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏

    转自:http://mrfufufu.github.io/android/2015/07/01/Codelab_Android_Design_Support_Library.html [翻]Andro ...

  5. Android Meterial Design Support Library

    extends:http://inthecheesefactory.com/blog/android-design-support-library-codelab At the moment I be ...

  6. Methods and Systems for Enhancing Hardware Transactions Using Hardware Transactions in Software Slow-Path

    Hybrid transaction memory systems and accompanying methods. A transaction to be executed is received ...

  7. Rocket - 断句 - Diplomatic Design Patterns: A TileLink Case Study

    https://mp.weixin.qq.com/s/afRVgTCYs1Mxu898uSmVaQ 整理一篇介绍Diplomacy和TileLink的文章.   原文链接: https://carrv ...

  8. A Realistic Evaluation of Memory Hardware Errors and Software System Susceptibility

    http://www.cs.rochester.edu/~kshen/papers/usenix2010-li.pdf Abstract Memory hardware reliability is ...

  9. A Full Hardware Guide to Deep Learning

    A Full Hardware Guide to Deep Learning Deep Learning is very computationally intensive, so you will ...

随机推荐

  1. Java Hour 46 SLF4J

    SLF4J(Simple Logging Facade for Jave). 上个章节在配置启动项目后,会报一个奇怪的错误,一开始以为是Maven 依赖有冲突,其实是和slf4j 密切相关的. 本文原 ...

  2. blend 从无到有系列之添加自定义Rectangle样式指定到资源文件

    相关链接 http://www.cnblogs.com/wildfeng/archive/2012/03/30/2425248.html http://www.cnblogs.com/jv9/arch ...

  3. JavaEE路径陷阱之getRealPath

    转自:http://blog.csdn.net/shendl/article/details/1427637   JavaEE路径陷阱之getRealPath   本文是<Java路径问题最终解 ...

  4. POJ 2185 Milking Grid KMP(矩阵循环节)

                                                            Milking Grid Time Limit: 3000MS   Memory Lim ...

  5. CC2540开发板学习笔记(一)——LED点亮

    一.实验内容: 点亮LDE1.2 二.实验原理: 1.电路原理图: 就一个发光二极管串联一个电阻.电阻是为了防止电流过大.利用发光二极管的单向导电性,在P1为高电平是点亮LED,在低电平是熄灭LED. ...

  6. node工具--express

    //使用supervisor  Connect是基于HTTP米快创建的:Express则是基于Connect上创建的: 绝大多数web服务器和浏览器之间的任务是通过url和method完成的,两者的组 ...

  7. OUYA设备的购买和安装

    OUYA设备的购买和安装 在为OUYA这款游戏终端做具体的开发之前,建议读者先上手感受一下这款设备的游戏体验.本节所涉及的内容包括,OUYA设备的购买.安装.设置,以及最终上手开始游戏这一系列的过程本 ...

  8. storm环境搭建(前言)—— 翻译 Setting Up a Development Environment

    Setting Up a Development Environment 搭建storm开发环境所需步骤: Download a Storm release , unpack it, and put ...

  9. Flex httpservice返回值类型和处理 (转)

    这两天在考虑flex与后端java服务交互的问题.在采用BlazeDS的Remote Object方式,还是传统的http service方式之间徘徊了一段时间 采用BlazeDS的Remote Ob ...

  10. 【问题&解决】手机网页Html代码实现(解决显示页面很小的问题)

    工作需要,要做一个手机自适应的网页效果,终于搞定,先分享并记录! 其实主要就是改掉HTML页面声明: 在网页中加入以下代码,就可以正常显示了: <meta name="viewport ...