Archive for July, 2012

VMCS

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.

This blog is for explaining the previous blog post about WCF. To build your own Web Service, the main two things you have to care of are the WSDL and the SOAP which defines your way of communication between the service and the client. WCF helps you manage this. All you have to do is to define the class, operation and the attributes that will be needed in the applications. To do so, in your application, build an interface class. Like the following and define the class and the operation that you will allow the application to see and use.

[ServiceContract]


public
interface
IMyService

{

[OperationContract]


string WelcomeMSg();

 

[OperationContract]


float Calculate(att t);

}

 

The interface will be called a service, you may have one or more service as much as your application needs and the number of applications and their use of the services available. The interface will be a service contract and the methods and functions in are called the operation contracts. In the class implementing this interface, it will contain the whole body code as a normal class.

 

public
class
MyService : IMyService

{


public
string WelcomeMSg()

{


return
“Starting the Service”;

}

 


public
float Calculate(att t)

{


if (t.op == ‘+’)

{


return t.firstnumber + t.secondnumber;

}


else
if (t.op == ‘-‘)

{


return t.firstnumber – t.secondnumber;

}

 


else


return 0;

}

}

 

Dealing with attributes, you might want the application and the service to share some attributes rather than entering the strings and integers in the parameters like the att in this example. So I added a new class and defined it a datacontract this is class contains all the attributes that will be shared between the client and the service, each one of them will be defined as a datamember so that both the application and the service can see. Like the following code:

 

 

[DataContract]


public
class
att

{

[DataMember]


public
float firstnumber { set; get; }

 

[DataMember]


public
float secondnumber { set; get; }

 

[DataMember]


public
char op { set; get; }

}

 

 

One of my previous posts was about the Service Oriented Architecture (SOA), this time will introduce to you the Windows Communication Foundation (WCF) Microsoft Implementation for the SOA. As usually Microsoft made it so easy for developers for building their own service. The WCF implements automatically the WSDL for the developers rather than writing the whole WSDL using XML for the service.

The WCF is composed of 2 main things the interface and the service itself, certainly you will need to define your endpoints and to configure it to the required URL programmatically. One of the main targets of the WCF is to allow multiple different platforms to reach each other and to execute some functions from each other’s like explained in the SOA. The WCF can be hosted as a normal Web service on IIS, or even can be hosted in another application. The WCF can be used developing Composite Apps, however the Composite Apps don’t only depend on WCF.

When developing using WCF, you have to define the functions that the clients will consume. The interface class must be defined as service contract, also you need to define the operations or the methods the client will consume otherwise the methods won’t be seen by the client.

You can find an example application in this link with a complete explanation in it. It is a small application just to clarify the WCF Technology.