当前位置:网站首页>Concept and understanding of memory address
Concept and understanding of memory address
2022-04-22 08:52:00 【Holy meow】

Introduction to this issue
This paper mainly introduces : How memory is used , How memory addresses are generated , How to use memory address .
Catalog
Memory
Memory is a very important memory on a computer , Provide enough memory space for the operation of the system and software , Of course, all programs in the computer run in memory . But here's the thing , Memory is only used for temporary storage of programs and data , In case of power off or power failure , The program and data will be lost .
Memory is actually a large space , I can't just store a data in such a large space , Then how can we effectively use this space ? So we divide the memory into small memory units , Each memory unit can store some data relatively independently . In this way, the memory can be used effectively .
Memory address
Origin of memory address
How to use these memory units ? In fact, it's not hard to , Just number each memory cell , Then you can access the corresponding memory unit through these numbers . Do you think this method looks a bit like real life , The courier goes through your home address and finds you a little similar . So later we call the number of each memory unit : Memory address .
How memory addresses are generated
We all know that when we buy computers, there will be 32 Bit and 64 Position , And here it is 32 Bit and 64 Bit actually refers to physical 32 root Address line and 64 root Address line , Since it's a wire, of course it can be energized , As long as the power is on, there will be Positive and negative Points ; In the electrical field, positive electricity will be used “1” To express , For negative electricity “0” To express , In this way, an incoming call signal can be converted into a digital signal . Now if there is one 32 Bit machine , Imagine being energized 32 The root address line will produce 32 individual “0” or “1” The sequence of components ( That is to say 32 Binary sequence of bits ), And this 32 The binary sequence of bits will produce 2^32 A different result . Here's the picture :
Then we might as well make these binary sequences into the number of each memory unit , Can that produce 2^32 A memory address ! To store an address in memory, you need the corresponding memory space to store ,32 The address of bit needs 4 Bytes ,64 The address of bit needs 8 Bytes .
The size of a memory unit
We know that the smallest unit of storage capacity of a computer is bits (bit), Next comes bytes (byte)、kb、mb、gb、tb、pb.
Which storage unit is suitable for the size of memory unit ? Let's start with an account , If the memory unit capacity is 1 What is the size of the whole memory in bytes (2^32 Car ride 1 Bytes = 4,294,967,296 Bytes = 4,194,304(kb)= 4,096(mb)= 4(gb)), The calculated memory size coincides with the memory size on the market . So after analysis 1 Bytes are the most appropriate capacity as a memory unit .
How to use memory address
stay C There is an operator in the language “&”, You can directly find the memory address , So it's called : Take the address symbol . We can take a look through the following procedure :
#include<stdio.h>
int main()
{
int a = 10;
printf("%p\n", &a);
}

The result of printing is :00BBf9EC, This is the shaping variable a Storage address , It's just using hexadecimal instead of binary to represent the address .

If this blog is helpful to you , Give bloggers a free like to show encouragement. Welcome to like comment collection ️, thank you !!!
If you have any questions or different opinions , Welcome to the comment area .
版权声明
本文为[Holy meow]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220749408418.html
边栏推荐
- Hyperledger Fabric1.4環境搭建及示例測試
- Shell notes
- Tissu hyperledger 1. 4 construction de l'environnement et essais d'échantillons
- 初识C语言~分支语句
- Tencent video automatic check-in detailed version (V value obtained by multiple methods)
- 冒泡排序及优化
- 蓝桥杯:Sine之舞[Jav语言用递归实现]
- quartz中@Scheduled cron表达式
- Return type of getchar function
- Insert sorting and optimization
猜你喜欢
随机推荐
The server is set to start automatically and regularly
SQL window function
JS跨域问题解决
elastic-job安装部署接入
PCIe学习-PCIe总线怎样做到在软件上兼容PCI总线(七)
CPU memory access space
Restore MySQL service after computer reset
Linux(CentOS)下安装 PostgreSQL
Putty 配置 - 自我感觉舒适
布尔类型【bool】
window如何查看端口被占用
mysqlbin log日志回放进行操作步骤
Differences between ROM, ram, SRAM, DRAM, flash and SDRAM
二分查找【详解】
win系统pinpoint编译安装遇到的坑和大家分享
tar 源码包管理-源码包安装方法
初识C语言~分支语句
Cesium realizes the monomer of buildings (divided into buildings and layers)
Hyperledger Explorer 0.3.9 environment construction
RHEL7——进程管理











