当前位置:网站首页>For programmers, those unfamiliar and familiar computer hardware
For programmers, those unfamiliar and familiar computer hardware
2020-11-09 23:53:00 【The way of architect's practice】
As soon as a programmer enters middle age , Before you know it, it will be overwhelming “ The sense of crisis ” Upper body , The boy who used to be no longer there , Time is so fair . Even if you can invent c Language , as time goes on , You are destined to be a slowly wilting eggplant , Slowly darkening grapes .
Watching the news of LETV's delisting , At the weekend, I quickly took my son's little hand , Review from the university that once took the exam ” Full marks “ The computer foundation of , You don't say , After reading only a small part of it, I found a fact , My memory is going down exponentially , The son can memorize , I'm in recession like I didn't go to college .
The original program written by a programmer is actually a program written by 0 and 1 The sequence of bits that make up , Or bit sequences ,8 A bit (bit) Be divided into a group , Called bytes . All the information in the system , Including the data sent over the network , Data in memory and disk files , Procedure, etc , It's all a bunch of bits (bit) It means . If you ask why you have to 8 Bytes? ? Can't Baidu ? I'm not a computer inventor ^_^. One thing may be very important , You can take it and blow water with the interviewer : An identical byte may represent an integer , Floating point numbers , Even strings , The only way to distinguish them is through the context of the data .
By the way , In fact, the way numbers are represented in a computer is a finite value , It's just that some high-level languages handle these values very well , I have to make complaints about it ,JavaScript It's not very good at dealing with this problem , Don't believe you can browser F12 Run it
0.1+0.2
0.30000000000000004
0.01 + 0.05
0.060000000000000005
Get down to business , As one has ” Code changes the world “ The dream programmer , Keep improving your craft , You have to understand the material structure of your true love . No matter how much diao The software runs on the basis of hardware , Although hardware has grown faster in recent years than you are aging , But the core content has hardly changed , This is the naked makeup of your true love .
CPU
Let's roll up this immature Baidu Encyclopedia
a central processor (CPU,central processing unit) As the computing and control core of computer system , It's information processing 、 The final execution unit of the program
To be frank , It's almost the core of the software , It's the engine that interprets and executes instructions . At present, the mainstream cpu At the heart of it is a 32 Bits or 64 position ( It could be even bigger in the future ) A storage device or register of length , It's called a program counter (PC, An abbreviation for egg pain ). At any moment , Program counters point to the address of an instruction in memory .
CPU On the surface, the instructions are executed according to a specific model , This model is determined by the architecture of the instruction set ( Every architecture type is different , That's why there is AMD,Intel). Since the system is powered up , Until the system is powered off ,CPU It's been executing instructions all the time . If there is no actual software execution instruction ? take windows Come on , Software layer virtual out of a “System Idle Process” process , It's called a system idle process , The process will tell cpu Hang up ( Stop working ), So this process is cpu Usage is the opposite of other processes , The higher the usage rate, the more CPU The less pressure .
CPU Read the instruction content from the memory address pointed to by the program counter , And explain that the instruction performs the operation of the instruction , Then update the program counter , Make him point to the next order , And it's very likely that this instruction is not adjacent to the last one . Simply speaking ,cpu The following operations may be performed frequently
- Data loading : Copy a piece of data from main memory to a register , To cover the original contents of the register .
- data storage : Copy a piece of data in a register to a location in main memory , To cover the original location of main memory .
- Command operation : Copy the contents of two registers to the logical unit , The logic unit will perform instruction operations on these two pieces of data , And store the result in a register .
- Command jump : Extract a piece of content from the instruction itself and copy it into the program counter , To override the original value in the program counter .
Main memory
Old rules , There is no knowledge beyond Baidu , A term without Baidu Encyclopedia , It's not very famous
Main memory (Main memory), Main memory for short . It is an important part of computer hardware , Its function is to store instructions and data , And can be done by the CPU (CPU) Direct random access . Modern computers are designed to improve performance , At the same time, the reasonable cost can be taken into account , Multi level storage system is often adopted . That is, the storage capacity is small , High speed cache memory , The main memory with moderate storage capacity and access speed is essential . Main memory stores information by address , Access speed is generally independent of address .
It's a temporary storage device , It is used to temporarily store program contents and processing results during program execution . In terms of Physics , Main memory consists of a set of dynamic random access memory chips ( You can think of it as a row of diodes ), Logically speaking , Main memory is a linear array of bytes , Each byte has a unique address , These addresses are from 0 At the beginning , Now the mainstream of the main existence on personal computers is already 16G Size , Let me still use this 4G The old man who lives is speechless .
Input/output device
The first computer class , The Mediterranean teacher talked about this concept , Although the details have now faded with my hair , But I can still occasionally see IO The word .
IO( Input and output ) It's the connection between the system and the outside world , Like the mouse and keyboard we use every day , Release the pressure to watch small movies on high-definition monitors , Store teacher Cang's disk and so on , These are all part of the I / O device .
Every IO Each device has a controller or adapter , It's a way to interact with the system , It's usually with IO Bus connection . Let's be frank , Every IO Every device has its driver , Otherwise, the system can't use the keyboard and mouse without any reason , Even today's peripherals are drive free .
The system bus
The bus is the bridge connecting the whole system , Physically, it's a set of electronic tubes . He is responsible for carrying information bytes and passing them between components , Like our software system design SOA The bus in . The bus transmits fixed length data according to the number of bits defined by the system , Every system is different , But now the mainstream length is either four bytes (32 position ), Or 8 Bytes (64 position ). From here we can think of ,64 Bit systems are faster than 32 A bit system is twice as fast , Maybe the future will soon enter 128,256 Era?
If you have to add a graph , This is the most representative picture
More wonderful articles
版权声明
本文为[The way of architect's practice]所创,转载请带上原文链接,感谢
边栏推荐
- Interviewer: what are cache penetration, cache avalanche and cache breakdown?
- 会展云技术解读 | 面对突发事故,APP 如何做好崩溃分析与性能监控?
- SQL intercepts the data before and after the '.'
- CUDA_全局内存及访问优化
- CUDA_ Global memory and access optimization
- 探访2020 PG技术大会
- Common concepts and points for attention of CUDA
- One image can hold 16x16 words! ——Transformers for large scale image scaling recognition (a brief review of ICLR 2021 papers)
- Exception: invalid or unexpected token
- DB engines database ranking in November: PostgreSQL holds the top spot in the same period
猜你喜欢
随机推荐
Coding style: SSM environment in MVC mode, code hierarchical management
推动中国制造升级,汽车装配车间生产流水线3D可视化
恒讯科技浅谈:出现服务器宕机的处理方式
Detach ()
Problems of input and button (GAP / unequal height / misalignment) and Solutions
Must see! RDS database all in one
DB-Engines 11月数据库排名:PostgreSQL坐稳同期涨幅榜冠军宝座
Error running app:Default Activity not found 解决方法
“wget: 无法解析主机地址”的解决方法
The kth smallest node in the print binary search tree of offer
Come and learn! Development Guide for personalized recommendation system (with internet disk link)
编码风格:Mvc模式下SSM环境,代码分层管理
C++ exception implementation mechanism
Gets the property value of a column in the list collection object
The number of more than half of the array is printed by the sword
Common concepts and points for attention of CUDA
pytorch训练GAN时的detach()
将Map中对应的key和value赋值到对象中
Python提示AttributeError 或者DeprecationWarning: This module was deprecated解决方法
将Map中对应的key和value赋值到对象中