Some Understandings about Physical Memory

今天小敏(化名)问了一些关于计算机内存的问题,其实我也是似懂非懂。只是平时写程序知道这些内存大概是怎么在计算机怎么分配的,怎么去使

It can be used, but it can't give a newcomer a complete and systematic explanation of the relationship between computer memory and program completion. (Actually, I can't tell right now, huh, huh).
We follow a few questions to understand the most basic computer memory:

  1. What is the difference between ROM, RAM, Flash, SSD, and HDD?
  2. Why do you need RAM? The origin of RAM?
  3. How are executable files loaded into memory?
  4. What are the different classifications of memory usage?

    ROM: (Read Only Memory) We all know the obvious difference between it and RAM: 1. Read-only feature 2. Power-off and no erase feature. ROM is also divided into types. PROM is one-time, and cannot be erased after being written once, while EROM can be erased and written multiple times. The application scenarios generally store some very fixed parameters, typically the BIOS of the computer motherboard. The disadvantage is that it is very troublesome to modify the stored data. In fact, if you can add a file system to it, you can also operate the files inside without a downloader.
    RAM: (Random Access Memory) This is easier for everyone to understand. In your mobile computer, the system runs memory SRAM and DRAM. The speed of DRAM is slightly slower than that of SRAM. DDR RAM is a kind of DRAM, which is the memory of many computers.
    Flash: Because the ROM data is not easy to modify, the respective disadvantages of the RAM power-down erasing. With the birth of Flash, Flash can be erased and not erased when power is turned off. Add a file system, storage algorithm, etc., and it becomes a U disk. Solid state drive = main control chip + a lot of Flash storage. Because there is no seek time for flash chips. And the reading speed is much faster than the traditional mechanical hard disk, so it is much faster. And finally input and output data with SATA (serial interface in computer) or IDE (parallel interface in computer).
    Hard disk: Distinguish solid-state hard disks, solid-state hard disks are electronically addressed through the main control chip. You can compare the physical addressing methods of mechanical hard drives. Mechanical hard drives have platters, tracks, and sectors. You need to adjust the head to read the data when you look up each piece of data.
    Here we do not discuss the storage medium of various devices. They are also different in the storage medium, which is also an important factor related to their speed.
    Now we know the basic form of memory that we see every day. So why do our computers and mobile phones need RAM? How did RAM come about?
    Second, the ancient card machine, read the card and execute one instruction. Students in the 21st world know that because the CPU reads instructions from the peripheral IO very slowly, and the CPU executes very fast, it needs a faster memory to load the instructions first, and then the CPU goes to the RAM to fetch the instructions, which will be much faster. . Since it wants to be fast, why not put the RAM directly into the CPU memory? CPU L1, L2, L3 cache, read and write faster than RAM. The main reasons for this are cost issues and performance issues. The production cost of the high-speed registers of the CPU is higher than that of the RAM. If the CPU cache is made 4G and replaces the RAM, the computer has no absolute advantage in performance compared with the RAM structure (the high-frequency instructions placed in the CPU high-speed cache are all high and frequently used instructions, while the high The frequently used instructions are not infinite, and the current CPU cache capacity is basically sufficient. When the cache is made larger, first, there are still so many frequently used instructions, and there is no need for non-high-frequency instructions to be placed in the cache. The CPU efficiency is greatly improved, and the second is to make the cache larger, which greatly improves the difficulty of CPU cost production, cost, and energy consumption). So RAM is used all the time.
    We will introduce the relationship between executable files and memory later.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325446081&siteId=291194637