Applications typically run in the computer's memory and operate on a variety of data.
Storage of data
The storage space of a computer can be divided into two parts: memory and external memory.
For a computer's storage unit, whether it is memory or external memory, is composed of countless electronic switches. These electronic switches have two states open and closed, with a state of 1 on, and a status of 0 when turned off.
A bit (bit) represents a basic unit of binary and a basic unit for computer storage.
Memory Unit
Daily files are generally stored in external memory such as hard drives. When a file or application executes, it is loaded into the computer's memory. Therefore, memory is the most important part of a computer. Without memory, no programs or files can be executed.
In the computer's memory, each byte-type storage unit has an address that can be used to save and read the data in memory.
In the computer, the memory addresses are encoded in byte order. This facilitates the program's addressing and data reading and writing. The external memory of the computer is also stored in the same way.
In a program, it is generally not necessary or recommended to manipulate the memory address directly, but it is automatically assigned by the compiler.
Storage of data
Inside the computer, bit is the most basic storage unit. Different types of data need to be converted into binary and then stored in memory.
Storage of character data
Each character variable is allocated a byte of memory space, so only one character can be stored. The character value is stored in the memory unit of the variable in the form of an ASCII code.
Storage of numeric data
In general, the computer, with 2 bytes to hold an integer, 4 bytes to hold the real number
Mapping of program in-memory
For a computer, everything is data. The program is also a kind of data, a program body, often also includes a large number of ordinary data and instruction data. When the computer is running, normal data is loaded into the computer's memory by the program, and the program is loaded into memory by the operating system.
The mapping of an application to a computer should include the following:
Memory allocates space for an application's directives
Memory allocates space for static data of the application
Memory space reserved for application Dynamic Data---Dynamic Data stack
Dynamic Data is divided into "auto-recycle" and "Manual recycle". Storing the memory space of the automatically reclaimed dynamic data becomes the stack space, storing the memory space that is collected manually, called the heap space.
Computer data storage