After coding for so long, how much do you know about running?

Why_ does_ it_ work 2021-11-25 15:32:19

I think the premise of learning programming is to understand programming , We learn the grammar of various languages , Algorithms and other entry-level, intermediate and high-level content , Have you stopped to think , Why can I program ? Where is his contact point with the computer ? In a variety of programming languages , What are they based on ?, What variables represent in our daily life ?

Computer


I want to delve into programming , We should start from the core , Understand the internal structure of the computer , Of course, we are here to discuss compiling software , So what are the most representative hardware ?
cpu A computer, I think what you listen to most is i5 Processor or i3,i7, I think this is Xiaobai's first idea of facing the computer , So why pay attention to it ?CPU When it comes to the data perspective of advanced pointer ( Written by freshman Meng Xin c The language can understand the version ( Two )) Said CPU It is the central processing unit. According to the description in that article, you should think of the relationship between it and memory address , In fact, it is a large integrated circuit , My job is to process data , Carry out operations .CPU I work for computers !
Memory

Memory holds variables in pointers ,cpu The control center points to the memory space through the address to store data , When memory is storing data , Memory just temporarily stores data , Once the computer is powered off , All the data in memory will disappear immediately

Hard disk

Hard disk is different from memory , It is the permanent storage of data , It will permanently save the file , The data, including the code, is on the hard disk , Only when used will it be in memory , It is much slower than storing data in memory , But hard disk is much larger than memory

Understand the main objects and functions of the computer , How do our normal programs run ?

Program ( Code )

Before we run a program , The program is stored on the hard disk , When we double-click the icon , The program will pass cpu Temporarily stored in memory , The program in memory passes cpu Run

( Because the main content of these two days is python, Then we'll take it python For example ):

stay python When the code is running , It's the same as the program ,python The interpreter is stored on the hard disk , adopt cpu Load temporarily saved in memory , In memory python adopt cpu function ,cpu Complete the code compilation

Data and variables

We talked about the data in the second issue , But it's still too abstract in the code , What we try to do through reality , To represent variables , Uncover what variables are in the computer .

Let's take wechat program as an example :

When we run wechat , Consistent with the above procedures, it is through cpu Load the wechat program in the hard disk into memory , In memory cpu Run , But does this program still need to enter account and password , The account and password exist in memory , Because this program runs in memory , So when wechat is running , It has opened up a memory space in memory, wechat , In the memory space, two small memory spaces are opened independently to store the account and password

So , Programs are used to process data , A variable is a variable that stores data


Follow up slowly update and c Language related content ,python It's still going on !

Please bring the original link to reprint ,thank
Similar articles

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25