Linux Lake 019: The virtual machine experience of the QEMU chapter

Source: Internet
Author: User
Tags intel core i7

Speaking of virtual machines, everyone is not unfamiliar. There are many scenarios in which virtual machines need to be used, such as a comrade who is interested in writing an operating system, often requiring a virtual machine to run and debug his system, and, for example, a friend who likes to study the architecture of a network, and needs to create a network of n systems on its own computer. (This requires the computer configuration is strong enough, fortunately, my computer is enough.) Also like to use Windows to play Linux, with Linux to play windows, so it is more convenient to play with the virtual machine; Finally, for example, some people want to study the most popular big data ah, cloud computing ah, want to try Hadoop, Spark, OpenStack, etc. There is no virtual machine how to build an experimental environment. I also use virtual machines on my own, VMware in Windows, feeling powerful, easy to use, and very efficient. I have a lot of content in my blog is in the virtual machine toss out, can you get it out? Under the Linux system, I also use virtual machines. For example, in my article, "Using GCC and GNU binutils to write 16-bit code that runs in x86 real mode, I use QEMU to run a freedos system to debug my 16-bit code." In fact, I am also a like to study the operating system of the Lord, to meet Qemu is from the "write your own operating system" this book began.

The classification of virtual machines is complex. What all virtual, semi-virtual what make people dizzy. I have used a lot of virtual machines, but also always confusing these concepts. and desktop users and enterprise users have different expectations for virtual machines. For example, I might expect a virtual machine like this:

1. It can simulate a complete personal computer, I can install any operating system I want to install;

2. It should have a better graphical interface, the simulated computer can also be accessible to run Windows or gnome such a graphics system, to play the best game;

3. The hard disk used by the guest operating system is a mirror file in the host operating system, can be copied and pasted at any time, can be packed away at any time;

4. It is best to simulate some of the hardware that does not exist, such as multiple network cards or something.

Obviously, VMWare workstation is the most satisfying virtual machine for desktop users who can perfectly meet my requirements. I often use it to toss out Linux distributions and run smoothly. Of course, in the open-source world of Linux we should not use cracked version of such things. But don't worry, in the Linux lake, there are VirtualBox, QEMU, such as virtual machine software available.

And for enterprise users, the virtual machines they expect might look like this:

1. It does not have to be able to simulate a complete computer, focusing on CPU, memory, disk and network card, the focus is can be used when the server;

2. It must be better performance, virtual CPU performance must be close to the physical CPU, must make full use of all the characteristics of the physical CPU, in order to performance, and even can only install the modified kernel operating system; (so-called para-virtualization technology.) )

3. Its isolation must be better, its purpose is to divide a machine into n machines, and the management of this n virtual machine host to the less resource-intensive, the client is the main, host is the second; )

4. Due to the pursuit of performance by enterprise users, the hard disk used by the client computer may be a separate physical hard disk, disk array, network file system and so on, not just a mirror file on the host;

5. It does not necessarily need to have a graphical interface, because the use of command line interface easier to manage, such as automation Ah, remote, ah, bulk ah what;

6. More enterprise-class high-availability requirements, such as what hot backup ah, dynamic migration ah what.

From the above expectations can be seen, virtual machine field of water is very deep, the market prospects are relatively broad. The various virtual machine manufacturers to make their own products to the hype that is also very common, because every user expectations of the point can be a big fuss. So-called coveting, as opposed to the net, a variety of virtual machines to see more enjoyable, it is better to try their own.

Today, I am introducing QEMU. As usual, my blog post is not a manual of the software, so please refer to the QEMU website for its learning materials:

Http://wiki.qemu.org/Main_Page

Alternatively, enter the following command in your own system:

Mans qemu-system-i386

Mans qemu-img

Wait a minute...

QEMU itself is a very powerful virtual machine, even in the Xen, KVM these virtual machine products are no more than QEMU figure. It is also mentioned in the official QEMU documentation that QEMU can use technologies such as Xen and KVM to accelerate. Why do we need to speed up, because if you use QEMU alone, it simulates a complete personal computer, its CPU AH what is simulated, it can even simulate different architectures of the CPU, for example, in the use of Intel X86 CPU computer simulates an ARM computer or MIPS computer, so the simulated CPU will run faster than the physical CPU. After using acceleration, the CPU instructions of the client operating system can be forwarded directly to the physical CPU, which greatly increases the efficiency of natural operation.

QEMU is also a very simple virtual machine, give it a hard disk image can start a virtual machine, if you want to customize the configuration of this virtual machine, such as with what kind of CPU ah, what kind of video card Ah, what kind of network configuration ah, specify the corresponding command line parameters can be. It supports disk mirroring in many formats, including disk image files created by VirtualBox. It also provides a tool to create and manage disk mirroring, qemu-img. The command-line arguments that QEMU and its tools use to view their documents directly.

Start the experience below. Let's take a look at the packages that are related to qemu in Ubuntu software sources:

My computer is Intel's CPU, and I think the virtual is also a personal computer, so I installed the nature is qemu-system-x86, another useful is qemu-utils. View the tools and documentation in the QEMU package:

Use QEMU-IMG to create a disk image file, start the virtual machine with qemu-system-i386, and install the operating system:

WinXP estimates are the best operating systems available on the web today. After running the above command, pop up the familiar system installation interface. The installation process I will not be wordy. Is the effect after installing the WinXP operating system. I can assign more parameters to qemu-system-i386, and when I start WinXP again, I have allocated 2G of memory to it, I've also used the-SMP 2 parameter to assign two CPUs to it, and I use-VGA vmware to assign it to the same graphics as VMware virtual graphics. Although two CPUs are specified, performance is still poor. Just drag the window. CPU usage soared to 100%.

And as you can see, the CPU in the virtual machine is displayed as 3.5GHz, but it is obviously modeled by QEMU and is significantly different from the physical CPU. In fact my Computer configuration is quite strong, core i7-4770k four core eight thread CPU, see the output of LSHW:

Conclusion:

Intel Core i7-4770k CPU, virtual out of XP also allocated 2G of memory and two CPUs, but the smoothness is still poor. Indicates that using QEMU alone does not meet the needs of our desktop users. With Xen or KVM? Is there a qualitative leap in performance? Please look forward to the next article. (Why not the next article?) Because I'm going to try VirtualBox the next article. )

(Jingshan Ranger in 2015-02-17 published in the blog Park, reproduced please indicate the source. )

Linux Lake 019: The virtual machine experience of the QEMU chapter

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.