Computer Basics-hardware knowledge and basic computer hardware knowledge
Computer Basics-hardware knowledge
1.Functions of programming languages:
However, all languages are used for communication, such as Chinese and English. The essence of programmer programming is to allow computers to work, while programming languages are the medium for programmers to communicate with computers. To make computers work, programmers must know what computers can do and how to do it.
2. Relationship between the operating system and hardware:
When the computer is started to the operating system, it can run the basic BIOS input program and then boot and act. When all hardware is checked and coordinated, the BIOS gives control to the operating system. If the Operating System reads a piece of data, it will convert a command such as press enter into a digital signal and hand it over to the chipset on the CPU and motherboard. They will convert these digital signals into a language that the machine can understand and then turn the machine the language is converted into an electrical signal, and the CPU and chipset are used to transmit different electrical signals to the components connected to the host. In the same way, the electrical signal is converted into a digital signal into the operating system, and then converted into a simulated image. the final result is displayed.
3. Application:
A computer program that runs in user mode and can interact with users and has a visual user interface. Applications are usually divided into two parts: graphical user interfaces (GUI) and engines.
4. Operating System:
It is the system software in the electronic computer system that is responsible for supporting the application program running environment and user operating environment. It is also the core and cornerstone of the computer system. Its responsibilities include direct monitoring of hardware, management of various computing resources (such as memory and processor time), and provision of application-oriented services such as job management.
5. Hardware:
In terms of concept, a simple personal computer can be abstracted into a similar model. The CPU, memory, and I/O devices are all composed of a system bus) connect and communicate with other devices through the bus
The structure of modern computers is more complex, including multi-bus. We will introduce them in the following section. Now let's take an example to introduce the various components:
Cpu is the human brain, responsible for computing
Memory is the memory of people, responsible for temporary storage
Hard Disk is a person's notebook, responsible for permanent storage
The input device is an ear or eye that receives external information and sends it to the cpu.
The output device is your facial expression and is responsible for the output results after processing.
All the above devices are connected by bus, which is equivalent to Human nerves.
6. CPU:
Core accessories in the computer. Its function is to explain computer commands and process data in computer software. The CPU is responsible for reading commands, decoding and executing commands in all operations on the computer.
7. Memory:
Memory is one of the important components in the computer and serves as a bridge to communicate with the CPU. All programs in the computer run in the memory, so the memory performance has a great impact on the computer. Memory (Memory) is also called internal Memory. It is used to temporarily store computing data in the CPU and data exchanged with external Memory such as the hard disk. As long as the computer is running, the CPU transfers the data to be computed to the memory for computation. After the computation is completed, the CPU sends the result, the memory operation also determines the computer's stable operation. Memory is composed of memory chips, circuit boards, and gold fingers.
8. Disk:
The storage information is not affected by power outages. The access speed is much slower than the memory, and disks are classified into two categories: hard disks and floppy disks. the disk capacity is relatively large, that is to say, it can record a lot of information, and is generally installed in the chassis. The capacity of the floppy disk is relatively small, which is usually placed outside the chassis.
9. Register:
A. Apart from General registers used to save variables and temporary results
B. Many Computers also have some specialized registers for the programmer's courseware, one of which is the program counter, which stores the memory address of the next instruction to be taken out. After the command is taken out, the program calculator is updated to execute subsequent commands.
C. Another register is the stack pointer, which points to the top of the current stack in the memory. This stack contains a framework in every process that has been in but has not been exited. Related Input parameters, local variables, and temporary variables that are not stored in registers are saved in the stack framework of a process.
D. the last very important register is the Program Status Word register (Program Status Word, PSW), which contains the bar code bit (set by the comparison command) CPU priority, mode (user or kernel), and various other control bits. Users usually read the entire PSW, but only write a small number of fields. In system calls and I/O, PSW is
10. Kernel mode and user mode and how to switch:
Software working in user mode cannot operate hardware, but our software, such as storm audio and video, must need to operate hardware, such as reading a movie file from a disk, therefore, you must go through the process of switching from the user State to the kernel state. Therefore, the user program must use the system call. The system call is stuck in the kernel and the operating system is called, the TRAP command switches the user State to the kernel state and enables the operating system to obtain the service. Consider the system call as a special process call Command, which has the special ability to switch from user to kernel.
11. Memory:
The second important thing in the computer is storage, which is fast (so the latency of cpu waiting for memory is reduced) + large capacity + low price. It is impossible to combine the three methods at the same time, so there are different processing methods as follows:
The storage system uses a hierarchical structure, such as the top-level memory with a high speed and a small capacity. Compared with the bottom-layer memory, each memory has a higher cost, and the difference is usually one billion orders of magnitude.
12. L1 cache, L2 cache:
Registers are L1 caches, which are made of the same material as the cpu and are as fast as the cpu. Therefore, the cpu has no latency. The typical capacity is 32*32 in 32-bit CPUs, the 64-bit cpu is 64*64. In both cases, the capacity is less than 1 kb.
High-speed cache is the L2 cache, which is mainly controlled by hardware for high-speed cache access ~ 64 bytes: rows 0, 64 ~ 127 is Row 1... The most common cache rows are placed inside the cpu or very close to the cpu cache. When a program needs to read a storage word, the high-speed cache hardware checks whether the required high-speed cache row is in the high-speed cache. If yes, it is called a high-speed cache hit. If the cache satisfies the request, you do not need to send the access request to the primary memory through the bus. This is slow after all. Cache hit usually requires two clock cycles. When cache is hit, you must access the memory, which requires a lot of time. Because high-speed cache is expensive, its size is limited. Some machines have two or even three levels of high-speed cache, and each level of high-speed cache is slower but easier than the previous level.
Caching plays an important role in many computer science fields. It is not just a cache row of RAM (random access memory. As long as a large number of resources can be divided into small parts, some of these resources will be used more frequently than other parts. In this case, cache can improve performance. A typical example is that the operating system is always using the cache. For example, most operating systems keep frequently used files (a part) in the memory to avoid repeated calls to these files from the disk, the result of converting the long path name of/root/a/B/c/d/e/f/a.txt to the disk address where the file is located is then cached, you can avoid searching for addresses repeatedly. After the url address on another web page is converted to the network address (IP) address, the conversion result can be cached for future use.
Cache is a good way to design two caches in the modern cpu, and then look at the two cpu design diagrams in 4.1. The first-level cache is called L1, which is always in the CPU. It is usually used to call decoded commands to the execution engine of the cpu. For those frequently used data, how many chips will be cached according to the second L1... In addition, L2 cache is designed to store frequently used memory characters. The difference between L1 and L2 lies in that there is no time delay for cpu access to L1, while L2 access has 1-2 clock periods (1-2 NS.
13. EEPROM, CMOS, BIOSBattery:
(Electrically Erasable PROM, Electrically Erasable programmable ROM) and flash memory are also non-volatile, But unlike ROM, they can be erased and overwritten. However, rewriting takes more time than writing data to RAM. In portable electronic devices, flash memory is usually used as a storage medium. Flash memory is the film of a digital camera, a portable transliteration player disk, and also applied to solid state disks. The speed of flash memory is between RAM and disk, but unlike the disk, it is worn out when the flash memory is erased too many times. Another type of memory is CMOS, Which is volatile. Many computers use CMOS memory to maintain the current time and date. The CMOS memory and incremental Time circuit are driven by a small battery. Therefore, even if the computer is not powered on, the time can still be correctly updated. In addition, CMOS can save the configuration parameters, for example, which of the following is the boot disk? The reason why CMOS is used is because it consumes a very small amount of power. An original factory battery can often be used for several years. However, when the battery fails, the related configuration and time will be lost.
14.Memory (RAM ):
Random access memory (RAM), also known as "random memory", is an internal memory that directly exchanges data with the CPU ). It can be read and written at any time and is very fast. It is usually used as a temporary data storage medium for the operating system or other running programs.
15.Disk structure:
16.Average seek time:
The mechanical arm moves the time from a cylinder to the adjacent cylinder at random to find the time. When the track is found, it thinks that the circle where the data is located, however, we do not know the specific position of the Data circle.
17.Average latency:
After the mechanical arm reaches the correct track, it must wait for the rotation to the slice where the data is located, which becomes the delay time.
18.Virtual Memory:
Many computers support the virtual memory mechanism, which allows computers to run programs larger than the physical memory by placing the programs in use into the memory for execution, at the moment, programs that do not need to be executed are placed in a certain part of the disk, which becomes virtual memory and swap in linux. The core of this mechanism is to quickly map memory addresses, one part of the cpu is responsible for the Memory Management Unit (MMU)
The 19MMU tape device driver and controller have one or more metal disks on the disk, which are rotated at a speed of 5400,7200 or 10800 rpm (RPM = revolutions per minute. Starting from the edge, a mechanical arm hangs on the disc, similar to the pickup arm on an old-fashioned black rubber player. Information is detached from the concentric circles of some columns on the disk. It is a series of binary bits (bit). For the statistical method, eight bits are called one bytes, 1024 bytes = 1 k, 1024 k = 1 M, 1024 M = 1G, so what we usually call the disk capacity is the number of binary bytes that a disk can write.
20The Startup Process of the bus, nanqiao and beiqiao operating systems:
As processors and memory get faster and faster, it is difficult for a single bus to process the traffic of the bus. As a result, the multi-bus mode is emerging, and they process I/O devices and cpu to memory faster.
North Bridge: PCI Bridge: connected to high-speed Devices
South Bridge (ISA Bridge): connects to a slow device.
21.Application startup process:
1. computer power-on
2. the BIOS starts to run. Check the hardware: cpu, memory, hard disk, etc.
3. When the BIOS reads parameters from the CMOS memory, select start device.
4. Read the content of the first sector from the boot device (the MBR Master Boot Record is 512 bytes, the first 446 is the boot information, the last 64 is the partition information, and the last two are the flag spaces)
5. Read the boot loader module and start the operating system according to the partition information.
6. The operating system then asks the BIOS for configuration information. For each device, the system checks whether the device driver exists. If not, the system requires the user to follow the device driver. Once all the device drivers are available, the operating system calls them into the kernel. Then, initialize the relevant tables (such as the progress table), install the processes required, and start the logon program or GUI on each terminal.