simplify the design of the hardware forming the interface between the processor and thememory system

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.

时间: 2024-10-08 12:30:08

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

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 any clock port. It may not work correctly. Please update ASSOCIATED_BUSIF parameter of a clock port to include this interface port. 在块设计中,时钟.复位.bus是分

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=A5K6NgF4pXAX2hp_NYCd97OEdHTBFlATxWb40HLv2XEbVjv2-LNNnBN1pheP51C_Rs0XYLAWSjySEfRWePKPW_ 参考文章:http://www.codeproject.com/Articles/17973/How-To-Get-Hardware-I

程序的机器级表示(五)

Procedure Example 准备调用swap_add之前的代码: 此时,ebp指向顶部,esp指向中部,call之后push return address 要改变ebp之前必须保存,以便之后恢复: setup code for swap_add: 此时,ebp指向中部,esp指向中部 body code for swap_code: finishing code for swap_code: 关于这一句ret的影响:resetting the stack pointer so that

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

译者地址:[翻]Android Design Support Library 的 代码实验--几行代码,让你的 APP 变得花俏 原文:Codelab for Android Design Support Library used in I/O Rewind Bangkok session--Make your app fancy with few lines of code 原文项目 demo: Lab-Android-DesignLibrary 双语对照地址: [翻-双语]Android D

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, and an initial attempt is made to execute the transaction in a hardware path. Upon a failure to successfully execute the transaction in the hardware

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

转自:http://mrfufufu.github.io/android/2015/07/01/Codelab_Android_Design_Support_Library.html [翻]Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏 Jul 1, 2015 译者地址:[翻]Android Design Support Library 的 代码实验——几行代码,让你的 APP 变得花俏 原文:Codelab for Androi

Codelab for Android Design Support Library

extends:http://inthecheesefactory.com/blog/android-design-support-library-codelab At the moment I believe that there is no any Android Developer who doesn't know about Material Design anymore since it officially becomes a design philosophy by shaking

A Full Hardware Guide to Deep Learning

A Full Hardware Guide to Deep Learning Deep Learning is very computationally intensive, so you will need a fast CPU with many cores, right? Or is it maybe wasteful to buy a fast CPU? One of the worst things you can do when building a deep learning sy

Operating system management of address-translation-related data structures and hardware lookasides

An approach is provided in a hypervised computer system where a page table request is at an operating system running in the hypervised computer system. The operating system determines whether the page table request requires the hypervisor to process.