Thoroughly understand the Memory concept (zz)

Source: Internet
Author: User
Although the word memory is often on our lips, how many people really understand the memory and the concept of memory?
For beginners who have just entered the computer world, the basic memory, upper memory, high-end memory, extended memory, extended memory, and reserved memory concepts are even more mysterious and hard to understand. So we will introduce the basic concepts of memory.

Basic knowledge
● Memory
Memory is the place where the storage program and data are stored. For example, when we use WPS to process documents, when you type a character on the keyboard, it is stored in the memory, when you choose to save the disk, the data in the memory will be stored in the hard (magnetic) disk. Before understanding it, you should also understand its physical concepts.
● Read-only memory (ROM)
ROM indicates Read-Only Memory. During ROM manufacturing, information (data or programs) is stored and permanently saved. This information can only be read and generally cannot be written. Even if the machine loses power, the data will not be lost. ROM is generally used to store basic programs and data of a computer, such as bios rom. Its physical shape is generally a dual-row Integrated Block (DIP.
● Random memory (RAM)
Random Memory (Random Access Memory) indicates that data can be read or written from it. When the power of the machine is off, the data stored in the machine will be lost. We usually purchase or upgrade the memory stick for computer memory, and the memory stick (SIMM) is a small circuit board that integrates the RAM Integrated Block, which is inserted into the memory slot of the computer, to reduce the space occupied by the RAM Integrated Block. Currently, there are 4 m/s, 8 m/s, and 16 m/s memory disks on the market.
● High-speed buffer memory (Cache)
Cache is also a concept we often encounter. It is located between the CPU and memory, and is a memory with a read/write speed faster than the memory. When the CPU writes or reads data to or from the memory, the data is also stored in the cache. When the CPU needs the data again, the CPU reads the data from the high-speed buffer memory instead of accessing the slow memory. Of course, if the required data is not in the Cache, the CPU then reads data from the memory.
After you understand the above concepts, you may ask: memory is memory, why are there various memory terms? What is the problem?
Before answering this question, let's take a look at the following section.

Physical storage and address space
Physical storage and storage address space are two different concepts. However, because the two are closely related, and both use B, KB, MB, and GB to measure their capacity, it is easy to produce confusion. Understanding these two different concepts helps beginners further understand the inner memory and make good use of the inner memory.
Physical memory refers to the memory chip actually exists. For example, the memory stick installed on the motherboard and the ROM chip of the system BIOS are loaded, the RAM chip on the display card and the ROM chip on the display BIOS are displayed, and the RAM chip and ROM chip on a variety of adapter cards are physical memory.
The storage address space refers to the range of memory encoding (encoding address. The so-called encoding is to assign a number to each physical storage unit (one byte), which is usually called a "Addressing ". The purpose of allocating a number to a storage unit is to facilitate data reading and writing. This is the so-called "Addressing" (so someone also calls the address space an addressing space ).
The size of the address space is not necessarily the same as that of the physical storage. For example, the number of 17 rooms on a floor is 801 ~ 817. These 17 rooms are physical, and their address space uses three-digit encoding, with a range of 800 ~ 899 there are 100 addresses in total. It can be seen that the address space is larger than the actual number of rooms.
For computers of more than 386 grades, the address bus is 32-bit, so the address space can reach 232, that is, 4 GB. But in fact, the physical memory we configured is usually only 1 MB, 2 MB, 4 MB, 8 MB, 16 MB, 32 MB, etc., far smaller than the range allowed by the address space. We can see the relationship between the address space and the physical storage.

  

Now, we can explain why different memory types such as general memory, reserved memory, upper memory, high-end memory, extended memory, and extended memory are generated.

Various memory concepts
Here we need to clarify that the different memory concepts we discuss are built on the addressing space.
The first PC launched by IBM uses a CPU of 8088 chips. It has only 20 address lines, that is, its address space is 1 MB.
PC designers use the low-end 640KB of 1 MB as RAM for DOS and applications. The high-end KB is reserved for ROM, video adapter, and other systems. Since then, this boundary has been determined and is still in use. The low-end 640KB is called the general memory, that is, the basic RAM zone of the PC. See figure 1. In the reserved memory, KB is the display buffer, 64 KB is the system BIOS (Basic Input/Output System) space, and KB is reserved. According to the corresponding physical memory, the basic memory zone only uses 0000 kb chips, occupying 80000 to of these kb addresses. Although the Display memory area has kb space, only 4 kb is enough for the monochrome display (MDA Card). Therefore, only the 4 kb physical memory chip is installed, which occupies the 4KB space between B0000 and B10000, if a Color Display (CGA card) requires 16 KB of physical memory to occupy 16 KB of space from B8000 to BC000, it can be seen that the actual address range is less than the allowed address space.
At that time (from the end of 1980 to the beginning of 1981), the memory size was enough for PC users. However, as the program grows, images and sounds were constantly enriched, as well as the emergence of new CPUs that can access larger memory space, the limitations of the initial PC and MS-DOS design become more and more obvious.
1. What is extended memory?
How EMS works
By 1984, that is, 286 was widely accepted, and people were increasingly aware that the 640KB limit had become a barrier for large programs. At this moment, Intel and Lotus, distinguished representatives of the two hard and software companies, jointly developed a solution combining hardware and software, which makes it possible for all PCs to access more than 640KB RAM. Microsoft has just launched Windows, and has high requirements on memory space. Therefore, it has joined the ranks in time.
At the beginning of 1985, Lotus, Intel, and Microsoft jointly defined the LIM-EMS, known as the extended memory specification, which is generally called EMS as the extended memory. At that time, EMS needed a memory expansion card installed in the I/O slot and an extended memory management program called EMS. However, the I/O slot address line only has 24 bits (ISA bus), which is not suitable for 32-bit machines of more than 386 grades. Therefore, memory expansion cards are rarely used. The extended memory in the microcomputer is usually used by simulation or extended memory using software such as EMM386 in DOS. Therefore, the difference between memory expansion and memory expansion is not the location of its physical memory, but the method used to read and write it. The following is a further introduction.
As mentioned earlier, extended memory can also be simulated and converted from extended memory. Unlike XMS, EMS uses the page frame mode. A page frame is a 64 kB space specified in 1 MB space (usually in the reserved memory area, but its physical memory comes from extended memory), divided into 4 pages, 16 KB per page. The EMS memory is also divided by 16 KB pages, and four pages can be exchanged each time. In this way, all EMS memory can be accessed. Figure 2 shows how EMS works. There are many EMM386.EXE, QEMM, TurboEMS, and quota Max drivers. EMM386.EXE is provided in both DOS and Windows.
2. What is extended memory?
We know that 286 has a 24-bit address line that can address 16 MB of address space, while 386 has a 32-bit address line that can address up to 4 GB of address space. For the sake of difference, the address space above 1 MB is called extended memory XMS (eXtend memory ).
There are two types of memory operations in a microcomputer of more than 386, one is called the real address mode or the other is called the protection mode. In actual mode, the physical address still uses 20 bits, so the maximum addressing space is 1 MB, so it can be 8086 compatible. The protection mode uses a 32-bit physical address with a addressing range of up to 4 GB. The DOS system works in real-world mode, and the memory space managed by it is still 1 MB. Therefore, it cannot directly use extended memory. To this end, Lotus, Intel, AST, and Microsoft have established a standard for memory extension in MS-DOS, that is, the extended memory specification XMS. Himem. sys we often see in the Config. sys file is the driver for managing extended memory.
The extended memory management specification is later than the extended memory management specification.
3. What is a high-end memory zone?
In actual mode, the address of the memory unit can be recorded:
Segment address: Intra-segment offset
Usually, the hexadecimal format is XXXX: XXXX. The actual physical address is composed of four shifts left of the segment address and then the offset in the segment. If each address is 1, it is FFFF: FFFF. The actual physical address is: FFF0 + FFFF = 10 FFEF, which is about 1088KB (16 bytes less). This has exceeded the 1 MB range and entered the extended memory. The size of the extended memory is about 64 KB, which is the first 64 KB of space larger than 1 MB. We call it High-end Memory Area HMA (High Memory Area ). The physical memory of HMA is obtained from extended memory. Therefore, to use HMA, physical extended storage must exist. In addition, the establishment and use of HMA also requires the support of the XMS driver HIMEM. SYS. Therefore, HMA can be used only after HIMEM. SYS is loaded.
4. What is the upper-level memory?
To explain the concept of upper-level memory, we have to look back at the reserved memory zone. Reserved memory zone refers to 640KB ~ KB (kb in total) area. This part of the region was clearly reserved for the system at the beginning of the birth of the PC, and user programs could not be fully inserted. However, this part of space is not fully used. Therefore, we all want to consider the remaining part and use it in an address space (Note: it is an address space rather than a physical storage space. As a result, UMB in another memory area is obtained.
UMB (Upper Memory Blocks) is called the Upper Memory or Upper Memory block. It is generated by occupying the remaining unused space in the reserved memory. Its physical memory is still taken from the physical extended memory, and its management driver is the EMS driver.
5. What is SHADOW memory?
For careful readers, there may also be a problem: 640KB ~ How to use this part of physical memory kb. Because this part of address space has been allocated to the system, it cannot be reused. To take advantage of this part of the physical memory, some 386 systems provide a relocation function, that is, the address of this part of the physical memory is relocated to kb ~ 1408KB. In this way, this part of physical memory becomes an extended memory, which can be used. However, this relocation function is no longer used in today's high-end machines, and this part of physical memory is retained as Shadow memory. The Shadow memory can occupy the same address space as the corresponding ROM. Shadow is composed of RAM, and its speed is much higher than ROM. When the content in the ROM (various BIOS programs) is loaded into the Shadow RAM with the same address, you can access the BIOS from RAM without having to access the ROM. This will greatly improve the system performance. Therefore, when setting the CMOS parameter, set the corresponding Shadow area to Enabled ).

Summary
After the above analysis, the division of the internal memory can be summarized as follows:
● The basic memory occupies 0 ~ 640KB address space.
● Reserved memory occupied kb ~ 1024KB address space. Allocated to the display buffer memory, the ROM on each adapter, and the system rom bios, the remaining space can be used as the upper memory UMB. The physical memory of UMB is taken from the physical extended memory. Physical RAM in this range can be used as Shadow RAM.
● The upper-level memory (UMB) is established using unallocated address space in the reserved memory. Its physical memory is obtained from the physical extended memory. UMB is managed by EMS and its size can be set by the EMS driver.
● The first 64KB area (1024KB ~ 1088KB ). Created and managed by HIMEM. SYS.
● The XMS memory complies with the extended memory zone managed by XMS. The driver is HIMEM. SYS.
● The EMS memory conforms to the extended memory zone managed by EMS. The driver is EMM386.EXE.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.