Operating system principle knowledge "Wonderful" asked "interest"

zhaozj2021-02-11  158

BEAR looked at it, and some affected, it was posted to earn participation.

Operating system principle knowledge "Wonderful" asked "interest"

Http://tech.sina.com.cn 2000/11/16 16:27

Sina Technology Forum

Sina Netizen: Little Baby

sequence

We have dealt with the operating system every day, understand the knowledge of some operating system principles is absolutely necessary, it allows you to understand how to work inside the operating system, why do you have such problems, to solve these problems to provide ideas? .

This article is completely written for ordinary computer users, omitting all difficult to understand algorithms, principles, not too many details, just to achieve ideas for the issue of ordinary computer users may be interested in. Writing these things is just that I am willing, I am afraid that I still write deeply, and beginners don't understand. If this 10k text allows you to have a deeper understanding of the operating system, it will not have this sweaty summer afternoon.

Q: What is interruption?

A: Interrupt, give an example of an easy to understand.

For example, Lianlian and Tang Tang are in the chess, see Lianlian, I can't hold out, just seeking a critical juncture, Tang Tang's girlfriend is coming, I don't want Tang Tang to accompany her to buy clothes, I can't buy clothes (Tang Tang hai :-)) So Tang Tang had to discuss with lotus lotus, first put the chessboard, and continue to fight after buying clothes. At the time of the palm light, Tang Tang took the face of the face to go back to the chessboard, and the lotus is not enough to defeat. This is the entire interrupt process. Let's take a look at how the interrupt process has occurred:

1) Interrupt request: Tang Tang's girlfriend wants him to go shopping

2) Interrupt response: Tang Tang is ready to put down the chess bureau to accompany the female friend

3) On-site protection: first seal the board

4) Interrupt treatment: Tang Tang accompanyd female friends shopping to buy clothes

5) Restore the scene: unsea the chessboard

6) Interrupt Back: Continue to fight

In a computer, the interrupt mechanism is very important, which is used to coordinate the response and processing of the system to various external events, and is the necessary conditions for implementing multiple tasks. It can be said that if there is no interrupt mechanism, there is no computer.

Oh, yes, if Tang Tang moves the game to the room, don't let his girlfriend bothered, this is called "interrupt shield".

Q: What does Ring3, Ring0 mean?

A: This is available from the privilege level from the CPU instruction system (used to control the command of the CPU to complete various functions). In all instructions of the CPU, some instructions are very dangerous. If it is wrong, it will cause the entire system to crash. For example: Qing memory, set clock, etc. If all the programs use these instructions, then your system has a dead n-back, it is not surprising. Therefore, the CPU divides the instructions into privileged instructions and non-privileged instructions. For those dangerous instructions, only the operating system and its related modules are allowed, and ordinary applications can only use instructions that do not cause disaster. Image stated that privileges are inadvertent, and non-privileged instructions are both old.

Intel's CPU divides the privilege level into 4 levels: Ring0, Ring1, Ring2, Ring3. Windows uses only two levels of RING0 and RING3, RING0 only gives the operating system, and Ring3 can be used. If the normal application is attempting to execute Ring0 instructions, Windows displays "illegal instruction" error messages. Although there is a privileged level of the CPU, it is unfortunate that the WINDOW98 itself has a lot of vulnerabilities, and the system using Windows 98 is also normal.

Q: Why do you have an operating system?

A: Haha, isn't you still feel the charm of the operating system? Because there is an excellent operating system like Windows, our machine will only have problems all day - this question, we need to reload Windows a day, so that we firmly remember the icon. Microsoft's name, and the name of the excellent programmer and boss like Birgate ... (The above text, please blame the bamboo), saying, although Windows is unstable, but absolutely can't deny it is today One of the best operating systems. The operating system plays an important role in your computer, which provides a running environment for all applications and isolates the application with specific hardware. For example, if you change a sound card in the machine, you only need to reinstall the sound card driver, but if there is no operating system, you must re-purchase all the applications for this new sound card so that these applications can know this. Sound card and can use it.

The operating system is like a computer's mass holder, managing various resources of the computer, such as memory, disk, CPU, etc. The application wants to use these resources, must be approved by the operating system (resource application), and the operating system is unified, the use time (resource allocation), the application must return the resource to the operating system (resource recycling) so that other Application is used. In this way, the computer system operates in an operational system under the management of the operating system.

Q: What is a process? What is the difference between the process with the program?

A: The process is an executive activity program on the computer. When you run a program, you launched a process. Obviously, the program is dead (static), the process is live (dynamic). The process can be divided into system processes and user processes. Any process for completing the various functions of the operating system is the system process. They are the operating system itself in operation; the user process does not have to talk more, all the processes you start are user processes. The process is the unit of the operating system for resource allocation.

Under Windows, the process is refined to thread, which is a smaller unit that can run independently.

Q: What is multitasking?

A: In the same time, if two or more processes are allowed in the same computer system, this is a multitasking. Modern operating systems are almost all multitasking operating systems, which can manage the operation of multiple processes at the same time.

The benefits of multitasking have been obvious. For example, you can listen to the MP3 side, and then you can even print the downloaded documentation, and these tasks will not interfere with each other.

Q: What is "concurrency"? What is "parallel"?

A: As the saying goes, you can't use it. This is the same for your computer. In principle, a CPU can only be assigned to a process in order to run this process. There is only one CPU in the computer we usually use, which means that only one heart is, let it use, and run multiple processes, it must use concurrent technology. It is quite complicated to achieve concurrent techniques. It is the most likely to understand the "time slice rotation process scheduling algorithm". Its idea is simple to introduce the following: Under the management of the operating system, all the running process turns using the CPU, each process allows the CPU Time is very short (such as 10 milliseconds), so that the user does not feel that the CPU is in turn to multiple process services, just like all the processes are running in the same way. But actually there is a CPU in any time and only one process has a CPU.

If a computer has multiple CPUs, the situation is different, if the number of processes is less than the number of CPUs, different processes can be assigned to different CPUs to run, so that multiple processes are truly running, this is parallel. But if the number of processes is greater than the number of CPUs, it is still necessary to use concurrent techniques.

In Windows, the CPU assignment is in units of threads, one process may consist of multiple threads, which is more complicated, but simply, there is a relationship: the total number of generals <= CPU Number: Parallel operation

Total number> CPU Number: Concurrent operation

The efficiency of parallel operation is obviously higher than concurrent operation, so in a multi-CPU computer, multitasking is relatively high. However, if you only run a process (thread) in a multi-CPU computer, you cannot play a multi-CPU.

It is worth noting that Windows 9x does not support multi-CPU system, if Windows 9X is installed on multiple CPU systems, there are more CPUs are also white.

转载请注明原文地址:https://www.9cbs.com/read-6058.html

New Post(0)