Archive for the ‘Virtualization’ Category

After one of my previous blog post about C++, I had to know the way how I can include my assembly code into my C++ file. I used to code with assembly for my graduation project in my college, mainly about Hypervisors. My first step was about to know the CPUID of the Microprocessor (I work on Intel Microprocessor). Then to see if the VMX is turned on or not.

I usually code C++ on Ubuntu and I had to code some basic things with the assembly, I faced a lot of problems that’s why I want to share it with you.

There are several ways to include them together:

  • The first one is to compile each file differentially and then link them together (I think this is the easiest way). Here is a link I found very nice explaining so.
  • The second way is to include the assembly code in your C++ code.
    • For coding on windows platform, will need you to define that this function or this instruction is done by the assembly code by just writing __asm { assembly code goes here } before the instruction. Like in this link
    • For coding on Linux platform, to include the assembly language in it, it will be a little different you have to write __asm__ volatile { assembly code goes here }

      PS: coding assembly on the Linux platform is a little strange, actually I am sure of the reason, I think it is related how the AT&T labs made it possible. For example for moving a values from registers to another you have to write down % before it. “movl %EAX, %EBX“.

So let’s get into a very simple code:

Mov eax, 10

Mov ebx 10

Add eax, ebx


And here is the C++ code and the assembly included in:

        __asm__ volatile{“movl $10, %eax;”

“movl $10, %EBX;”

“addl %ebx, %eax”}


One of the major problems I faced was this error: “operand number out of range”, that will be for the reason that each platform will require a different syntax to include your assembly in it. Please if you face any problem, please let me know so I can help you J


Based on the latest Blog posts about Virtualization on Intel Microprocessor, and the VMM (Virtual Machine Monitor) the Hypervisor is the main component for the Virtualization. The Hypervisor most likely is called the VMM (Virtual Machine Manager), I think that this is the component that is managing the Virtual Machine Monitor of the processor to gain 3 main things:

  1. Equivalence, for executing the applications running on the guest OS as it is running on a normal PC
  2. Hardware Resource Control, this feature mainly prevents the guest OS from changing or accessing any kind of the configuration system
  3. Efficiency, that means that all the instructions of the guest OS must be executed simply and in an easy way without any interfering of the Hypervisor or the Virtual Machine Monitor.

Types of Hypervisor:

  • Bare metal Hypervisor

    The bare metal is the hypervisor that can control directly the Hardware resources and can easily manage the resources for different Guests that want to run their applications.

  • Hosted Hypervisor


    The hosted Hypervisor is a hosted hypervisor on an operating system that acts like an application that the operating systems executes its instructions.


Posted: July 24, 2012 in Live in a Cloudy World, Virtualization

Diving more in Intel Platform after one of my blog post about Virtualization on Intel Platform, I will post today about the VMCS; Virtual Machine Control Data Structure. The operation-root and the transitions between the VMM and the Guest OS are controlled by the data structure called VMCS. As each Virtual Machine runs on different logical processor (Virtual Processor) and for each logical processor, you can have several Virtual Machines on it, so for each Virtual Machine a 64-bits VMCS pointer is assigned. The logical processor associates a part of the memory called VMCS Region where the VMCS Pointer is its reference.

For the logical processor, it might have multiple VMCSs, the VMCS can set a virtual machine to be active or to be inactive. However to executes the required instructions, the VM must be active and current. No more than one Virtual Machine can be active in the same time

For each Virtual Machine running a logical processor, it may have 3 main things defining how it will run on the processor:

  • Whether to be active or inactive
  • To be current and not current
  • To be launched or clear.

Let’s take the first one, after the VMX operation (VMXON) is executed to launch the VM, the active VM is maintained its state on the memory, or the processor or even on both of them. The logical processor can’t handle more than one active VM, the others remain inactive.

The logical processor only executes one VM instruction per time, so for the active processor to simply arrange the turn for the VM to execute its function, the VM must be set to current to be able to execute its function, after that it will move to not current, so others can move to the current VM.

Finally the last thing, (this is part is hard to find on the internet, only the explained part was about the active, inactive part and the current and not current part. The only source available was through Intel developer system manual) the launch and the clear status of the VM, once the VM is moved to the current state, an operation called VMLaunch that simply controls the instructions executed with each VMCS.

I got this image from the Intel Book, it is a very good way to explain the sequence or how the VM works on the logical processor.

Guest VM

Posted: July 24, 2012 in Live in a Cloudy World, Virtualization

Continue on my previous blog posts, Virtualization on Intel Platform and the VMM (Virtual Machine Monitor), I will continue writing this time on the Guest VM. Just to summarize that the VMM acts as a host that mainly control the hardware resources. The Guest VM is a guest software environment that supports all what is related to the software and kernel that can control and executes its functions on the abstracted resources. Each Guest VM runs in an independent way with no relation with any other VM.

Talking about Virtualization on Intel Platforms, the first thing you need to know and to understand before starting developing on the Intel Processor is the VMM (the Virtual Machine Monitor). This is the responsible for managing the guest Virtual Machines. It presents the guest VM with an abstraction of the processor. it is also able to retain the hardware resources. The VMM starts by the operation of the VMXON and ends by the command of the VMXOFF. For the VM can start by the command VMLAUNCH or VMRESUME, the VMM then lose controls on the VM and can regain it when a VMEXIT command is used. Will follow this blog post with another one related to the VMM and interruption handling after I cover the guest software, VMX operations, VMX Transitions and the VMCS Region.


Posted: June 23, 2012 in Virtualization

Designing an application for the clients, you will always have to put into considerations how their data and application will be maintained. You will also have to put in mind that your application can be customized for your clients, from the user interface to some process and removed or added new functionalities. The multi-tenancy concept is how you can create multiple instance of your application for different clients in a way that each client can access his own customizable application and can only access his own data.

There are a lot of benefits for the Multi-Tenancy, in the past for hosting an application that multiple clients can use; they had to host each client’s application on separate hardware. With multi-tenancy, they all share the same application and they can make some changes in it according to their needs, which reduce the infrastructure cost and increase the level of security to make sure their data is not merged with others.

Starting to build my own cloud from scratch, as I am Microsoft Student Partner, I will start by the platform Windows Azure built on, which is Intel Microprocessor. I will start by how the Virtualization is executed on the processor level. I am sure every developer, especially those who develop using C/C++ languages are familiar with what is the data structure and why are we using it in our application. For the virtual machines, there are some structures that you have to know about, Virtual Machine Control data Structure (VMCS), you won’t find the VMCS, and the processor must have the VMX extension to allow you as developer to be able to build VMs on it or play with its internals.

The VMX extensions allow you to build 2 kinds of VMs on the processor, the first called the VMM (Virtual Machine Monitor) and the second is the Guest OS. We can know from their names that the VMM is made for the full control of the infrastructure and the hardware platform; it acts as it is the host. The Guest VM acts like a stack for the guest OS and applications, it acts and executes normally as an application with no VMM using the shared resources. Just to point out that each VM runs independently than the other VMs sharing the same resources.

So how that works and what the VMM can do to the Guest application?

The main 2 transactions made between the VMM and the guest VM is when the guest VM starts or when it exits. When the VMM send the instruction VMLAUNCH or VMRESUME, it does something like releasing the guest VM and it regains back control on it when this guest VM exits.

for the Processor, each logical processor can handle only one VM at a time that doesn’t mean that It cannot support more than that but each VM has something called the launch state which defines which VM is active and which is inactive. For the actives one, the logical processor executes the VM with the current state.




Finally I got windows server installed on one of my computer, continuing my research on the cloud computing. Now I have installed the Windows Server 8 Hyper-V, I will show you how to manage it and configure the virtual machines created on your own private Cloud. So for those of you who don’t know Windows PowerShell here is one of my latest blog posts, I have already done, describing it and how can you benefit from it. Just to mention my version of Windows Server 8 is: Windows Hyper-V server 8, it is a bit different than the others; here you can do all the required things using Cmdlet.

First of all you have to get the PowerShell for Hyper-V, which extend and give you more capabilities than the PowerShell already installed on your Hyper-V. You can get the additional libraries from this website. After you download the Zip file and unzip it, you can now install it on your Hyper-V just by changing the directory to where the file is unzipped and then enter the following command or call the file of the installation: install.cmd. You can monitor the installation and at the end you can see the PowerShell window opened at the end.

You can get all the command by simply entering the following command in the PowerShell window:

    Get-Command –Module -HyperV

Now we have the PowerShell installed, so let’s create our first VM using the PowerShell Libraries. The steps are so simple you can create VM on the server you are working on by simply typing the following command:

    New-VM <VM-Name>

For creating the VM on different server you have to define its name after the VM name.

    New-VM <VM-Name> “<Server-Name>”


Posted: February 7, 2012 in Virtualization
Tags: ,

If you are an IT pro, developer, or even an end-user you use the Virtualization in your daily life. We do have a lot of forms for Virtualizations, virtual network, virtual machine, virtual memory, or even Virtual drive and lots of other examples. Let me ask a question on your PC, how many drives do you have when you open “My Computer” 2? 3? Actually it is physically only one Hard Disk only one but you divide it to get several drives. So why did you divide it into several virtual drive?

I think most of the time it is done to help you organize your data.

Let’s imagine a complete infrastructure, or a number of servers, do you think that it is possible to host the applications on a single server? I mean dedicated server? Well dedicated server is a solution but not economical very right, if you do on your own infrastructure have multiple servers and multiple applications, using a dedicated server for each application is a waste of money.

Virtualization has a solution for this, if you combine those server and try to consider them as one infrastructure or one big server, you can then create the number of Virtual machine where they share the same hardware resources but to handle several applications in the same time. In other words Virtualization create different and a number of servers on the same Hardware. Virtualization can do more, the dynamic IT infrastructure can help you dynamically respond to the change of demand for the applications, and it helps you get more and more out of your hardware resources.

I am a cloud computing freak, I love it and I believe in it, why am I writing for Virtualization?

The answer is too simple, Virtualization and Cloud Computing are 2 different concepts and they do have the same targets “the high availability”, “the best utilization of the hardware resources”, “reduce the IT Costs” and so on. Cloud Computing is based on Virtualization, the developers who develop the apps deal with Virtual Machines the Virtual Machines are created on demand and the cloud consumer pay for what they only they need. Cloud Computing and Virtualization have the shared resources, or shared infrastructure but Cloud Computing leverages the Virtualization to meet different customers’ needs, from the IT Operators, Developers and even the End User.