(7.1)--7.1Basicprincipleofdatastorage.pdf

上传人:刘静 文档编号:57973620 上传时间:2022-11-06 格式:PDF 页数:9 大小:447.45KB
返回 下载 相关 举报
(7.1)--7.1Basicprincipleofdatastorage.pdf_第1页
第1页 / 共9页
(7.1)--7.1Basicprincipleofdatastorage.pdf_第2页
第2页 / 共9页
点击查看更多>>
资源描述

《(7.1)--7.1Basicprincipleofdatastorage.pdf》由会员分享,可在线阅读,更多相关《(7.1)--7.1Basicprincipleofdatastorage.pdf(9页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、Basic Principle of Data StorageBasic Principle of Data Storage7.1When using a computer to solve an actualproblem,some space which is needed to storethe data to be processed,the intermediate resultand the final result of the operations,is thememory space of the computer.The memory space contains a la

2、rge number ofstorage units.Each storage unit is identified by aunique memory address and can store 1 bytedata.The number of the memory address startsfrom 0 and increases by 1 in sequence.Thefigure on the right is an example of memoryaddress.Basic Principle of Data Storage7.1 In a 32-bit system,the m

3、emory address consists of 32-bit binary numbers.The memory address number starts from 0 and the maximum is 232-1.Therefore,the maximum memory capacity supported by the 32-bit system is 232(=4G)bytes in theory.In a 64-bit system,the memory address consists of 64-bit binary numbers.Therefore,the maxim

4、um memory capacity supported by the 64-bit system is 264(=16777216T)bytes in theory.Basic Principle of Data Storage7.1When running a program,the system will allocate some memory space to the program.According to the different types of data stored in the memory space,it can be divided into 4 areas:Co

5、de areastores the code of the program(when the program is run,the program will be loaded into the code area of memory before execution).Global data areastores global data and static data in the program(when defining global variables or static variables,memory space will be allocated in the global da

6、ta area to store data).Basic Principle of Data Storage7.1Heap areastores the dynamic data in the program(when using the dynamic method to allocate memory,memory space will be allocated in the heap area to store data.We will learn about dynamic memory allocation later).Stack areastores local data in

7、the program(when defining local variables,memory space will be allocated to store data in the stack area).Basic Principle of Data Storage7.1When defining any variable,the system will allocate a certain size of memory space for it.Accessing the variable is actually accessing the data in its correspon

8、ding memory space.Basic Principle of Data Storage7.1 The memory address in a 32-bit system consists of 32-bit binary numbers.Hexadecimal number is the compressed representation of binary number.1 digit of a hexadecimal number is equivalent to 4 bits of a binary number.To simplify address representat

9、ion,memory addresses in 32-bit systems are usually represented by 8 hexadecimal digits.Similarly,memory addresses in 64-bit systems are usually represented in 16 hexadecimal digits.Basic Principle of Data Storage7.1ExampleIn C+,given a variable definition statement:int a=0 x61626364;the system will

10、allocate a 4-byte memory space for the variable a,and the data stored in this piece of memory space is 0 x61626364.Assume that the first address of the variable memory space is 0 x0025f758,then:0 x640 x630 x620 x610 x0025f7580 x0025f7590 x0025f75a0 x0025f75bMemory AddressDataBasic Principle of Data

11、Storage7.1Tip:In fact,when defining a variable,the memory space allocated by the system for the variable may be different in different environments.Therefore,when you define the variable a on your own computer,you may check that the corresponding memory space is generally inconsistent with the memory address shown in the right figure.sint a=0 x61626364;couthexaendl;cout&aendl;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 大学资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁