In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "what is the web back-end virtualization technology". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the web back-end virtualization technology"?
Kernel refers to the kernel of the operating system.
All operating systems have kernels, whether Windows or Linux, which manage three important resources: computing, networking, and storage.
Computing refers to CPU and memory, network is network equipment, storage is hard disk and so on.
The kernel is a big butler. Imagine that there are a lot of programs running on your machine, such as word, excel, watching video, listening to music, every program has to use CPU and memory, have to access the Internet, have to save hard disk, if there is no one in charge of the butler, everyone can use it casually, it will be a mess. Therefore, we need the butler to coordinate and dispatch the whole resource, who uses it first, who uses it later, how much, who puts it here and who puts it there, all need the housekeeper to worry about.
So in this computer family, the butler has higher permissions than ordinary programs and runs in kernel mode, while other ordinary programs run in user mode. Once a program in user mode wants to apply for public resources, it needs to apply to the butler. The butler distributes it before it can be used.
In order to distinguish between kernel mode and user mode, CPU specifically sets up four privilege levels of 0meme 1pm 2pm 3 to do this.
At that time, when writing the Linux kernel, it was estimated that Daniel did not know that the virtual opportunity would shine in the future. Daniel thought, there are two levels of privileges, one kernel state and one user mode, but there are four levels, so they are so extravagant and rich, so they are open to use. Kernel mode runs at level 0, while user mode runs at level 3, accounting for two ends.
When Daniel is writing the Linux kernel, if the user mode program does something, it will break the wrench to level 3. Once you want to apply for more resources, you need to apply to break the wrench to level 0, so that the kernel can access these resources with high privileges, apply for resources, return to the user mode, and then break the wrench back.
The program ran very smoothly until the advent of the virtual machine.
If you have used Vmware Desktop or Virtualbox Desktop, you can use this virtualization software to create a virtual machine and install a Linux or windows in the virtual machine. The external operating system can also be Linux or Windows.
When you use virtual machine software, like your excel, it is placed side by side in your taskbar, which is a common application.
When you enter the virtual machine, the excel in the virtual machine is also a common application.
But when you put yourself in the virtual machine and think about life from the perspective of the kernel, you are confused, what am I?
From the point of view of the operating system on the hardware, I am an ordinary application that can only run in the user mode. But when Daniel gave birth to me, every line of my code told me that I was a kernel and should run in kernel state. when the excel in the virtual machine wanted to access the network, he asked me that my code would work hard to operate network resources. I tried hard, but I couldn't do it. I didn't have permission!
I split up.
The virtualization layer, that is, Vmware or Virtualbox, needs to help me solve this problem.
The first way, full virtualization, is to lie to me. Virtualization software simulates fake CPU, memory, network, hard disk to me, makes me feel good about myself, and finally looks like a kernel again.
The real working mode is like this.
Virtual machine kernel: I'm going to run an instruction on CPU!
Virtualization software: no problem, you are the kernel, you can run
The virtualization software turned to the physical kernel and told the housekeeper that one of the virtual machines I managed was going to execute a CPU instruction to help with a short period of idle CPU time. Let me run an instruction on his behalf.
Physical machine kernel: you wait, the other one is running. All right, he's finally finished. It's your turn.
Virtualization software: I ran on his behalf, finally finished, and came out with the result.
Virtualization software turned to the virtual machine kernel: dude, after running, the result is this, I said you are the kernel, absolutely have permission, no problem, next time run instructions to find me.
Virtual machine kernel: it seems that I am really the kernel. But brother, it seems that this instruction is a little slow.
Virtualization software: this is good, several are running in line.
The memory application mode is as follows.
Virtual machine kernel: I need 4 gigabytes of memory to boot, so I can share it with the applications above.
Virtualization software: no problem, only 4G, you are the kernel, apply right away.
The virtualization software turned to the physical kernel: report, housekeeper, I started a virtual machine and needed 4G memory. Give me four rooms.
Physical machine kernel: how come there is another virtual machine? all right, I'll give you four rooms: 90, 91, 92, 93.
The virtualization software turned to the virtual machine kernel: dude, with memory, the four rooms are all yours, you see, you are the kernel, exclusive resources, from the 0 number is yours.
Virtual machine kernel: it seems that I am really a kernel and can use it from scratch. Well, I'll put something in the third locker in room 2.
Virtualization software: to put things ah, no problem. I thought to myself: I check, this virtual machine is at the beginning of room 90, he wants to put things in room 2, which is equivalent to putting things in room 92.
The virtualization software turned to the physical kernel: report, housekeeper, the virtual machine above me is going to put something in the third cabinet in room 92.
All right, after talking about the examples of CPU and memory, not to mention the network and hard disk in detail, it is also similar that virtualization software simulates a virtual machine kernel. In fact, everything needs to be redone by virtualization software.
One of the disadvantages of this approach is that it is slow, often unbearably slow.
So the virtualization software thought, can I not be the microphone, or let the virtual machine kernel face up to its own identity, not to mention that you are the kernel, you are really breathing, you are not a physical machine, you are a virtual machine.
But how to solve the problem of permission level? So Intel's VT-x and AMD's AMD-V helped at the hardware level. Who told you who wrote the kernel to use the grade so extravagant, used up 0, even 3, do not save a little, there is no way, but to start another stove to get a new logo bit, indicating whether it is currently in the virtual machine state, or under the real physical machine kernel.
For the virtual machine kernel, as long as the flag bit is set to the virtual machine state, most of the instructions can be executed directly on the CPU, and there is no need for the virtualization software to report it in the middle. Unless there are particularly sensitive instructions, it is necessary to set the flag bit to run in the kernel state of the physical machine, which greatly improves the efficiency.
So when installing a virtual machine, be sure to turn on this flag bit of the physical CPU. Check grep "vmx" / proc/cpuinfo for Intel and grep "svm" / proc/cpuinfo for AMD.
This is called hardware-assisted virtualization.
In addition, when accessing the network or hard disk, in order to achieve higher performance, we also need to let the virtual machine kernel load a special driver, and let the virtual machine kernel relocate its identity at the code level. I can't access the network or hard disk like a physical machine, but in a special way: I know I'm not a physical machine kernel, I know I'm a virtual machine, and I don't have that high authority. I am likely to share physical resources with many virtual machines, so I have to learn to wait in line. I actually write a file on a physical machine. Can I change the way I write files? I send network packets. It is not sent to a real network device at all, but to a virtual device, whether I can copy it to him directly in memory, and so on.
Once I knew that I was not the kernel of the physical machine, I learned from the bitter experience and had to re-recognize myself. Instead, I could find many ways to optimize my resource access.
This is called quasi-virtualization or paravirtualization.
At this point, I believe you have a deeper understanding of "what is the web back-end virtualization technology". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.