Saturday, 28 May 2016

Virtualization in Cloud Computing:-

Virtualization in Cloud Computing:-
Virtualization is the "creation of a virtual (rather than actual) version of something, such as a server, a desktop, a storage device, an operating system or network resources".

In other words, Virtualization is a technique, which allows to share a single physical instance of a resource or an application among multiple customers and organizations. It does by assigning a logical name to a physical storage and providing a pointer to that physical resource when demanded.
OR

In a nutshell, virtualization is software that separates physical infrastructures to create various dedicated resources. It is the fundamental technology that powers cloud computing.

Virtualization software makes it possible to run multiple operating systems and multiple applications on the same server at the same time," said Mike Adams, director of product marketing at VMware, a pioneer in virtualization and cloud software and services. "It enables businesses to reduce IT costs while increasing the efficiency, utilization and flexibility of their existing computer hardware."

The technology behind virtualization is known as a virtual machine monitor (VMM) or virtual manager, which separates compute environments from the actual physical infrastructure.
 
What is the concept behind the Virtualization?
 Creation of a virtual machine over existing operating system and hardware is known as Hardware Virtualization. A Virtual machine provides an environment that is logically separated from the underlying hardware. The machine on which the virtual machine is going to create is known as Host Machine and that virtual machine is referred as a Guest Machine
Types of Virtualization: There are many types of Virtualization, which are following:-
  1. Hardware virtualization
  2. Operating system Virtualization
  3. Server Virtualization
  4. Storage Virtualization

1. Hardware Virtualization:- When the virtual machine software or virtual machine manager (VMM) is directly installed on the hardware system is known as hardware virtualization.

The main job of hypervisor is to control and monitoring the processor, memory and other hardware resources.

After virtualization of hardware system we can install different operating system on it and run different applications on those OS.

Where Usage of Hardware virtualization:
Hardware virtualization is mainly done for the server platforms, because controlling virtual machines is much easier than controlling a physical server.

2. Operating system Virtualization: When the virtual machine software or virtual machine manager (VMM) is installed on the Host operating system instead of directly on the hardware system is known as operating system virtualization. 

Where Usage of Operating system Virtualization: 
Operating System Virtualization is mainly used for testing the applications on different platforms of OS.

3. Server Virtualization:- When the virtual machine software or virtual machine manager (VMM) is directly installed on the Server system is known as server virtualization.

Where Usage of Server Virtualization:-
 Server virtualization is done because a single physical server can be divided into multiple servers on the demand basis and for balancing the load.
4. Storage Virtualization:- Storage virtualization is the process of grouping the physical storage from multiple network storage devices so that it looks like a single storage device. Storage virtualization is also implemented by using software applications. Where Usage of Storage Virtualization:
Storage virtualization is mainly done for back-up and recovery purposes.

How does virtualization work in cloud computing?


Virtualization plays a very important role in the cloud computing technology, normally in the cloud computing, users share the data present in the clouds like application etc, but actually with the help of virtualization users shares the Infrastructure.

The main usage of Virtualization Technology is to provide the applications with the standard versions to their cloud users, suppose if the next version of that application is released, then cloud provider has to provide the latest version to their cloud users and practically it is possible because it is more expensive.

To overcome this problem we use basically virtualization technology, By using virtualization, all severs and the software application which are required by other cloud providers are maintained by the third party people, and the cloud providers has to pay the money on monthly or annual basis.



Tuesday, 12 April 2016

Reference type and value type:-



Reference type and value type:-


Before going to decision value type and reference type we should know about Data type
What is Data type?
                       
Data type means difference type of data such as integer, string, char, float etc.
But we can also say data type is in the form of structure or class or reference.
As we know that there are two type of memory in for storing values at runtime of program in C#.
1.      Stack
2.      Heap
The data types which are value type it will store on stack memory.
The data types which are reference or class type it will store on heap memory.
Difference between a Value Type and a Reference Type
The Types in .NET Framework are either treated by Value Type or by Reference Type. A Value Type holds the data within its own memory allocation and a Reference Type contains a pointer to another memory location that holds the real data. Reference Type variables are stored in the heap while Value Type variables are stored in the stack.

Value Type:
A Value Type stores its contents in memory allocated on the stack. When you created a Value Type, a single space in memory is allocated to store the value and that variable directly holds a value. If you assign it to another variable, the value is copied directly and both variables work independently. Predefined datatypes, structures, enums are also value types, and work in the same way. Value types can be created at compile time and Stored in stack memory, because of this, Garbage collector can't access the stack.
e.g.

               int x = 3033;

Here the value 3033 is stored in an area of memory called the stack.
Reference Type:
Reference Types are used by a reference which holds a reference (address) to the object but not the object itself. Because reference types represent the address of the variable rather than the data itself, assigning a reference variable to another doesn't copy the data. Instead it creates a second copy of the reference, which refers to the same location of the heap as the original value. Reference Type variables are stored in a different area of memory called the heap. This means that when a reference type variable is no longer used, it can be marked for garbage collection. Examples of reference types are Classes, Objects, Arrays, Indexers, Interfaces etc.
e.g.

               int[] iArray = new int[33];

In the above code the space required for the 30 integers that make up the array is allocated on the heap.
Stack and Heap
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM.



Differences between Stack and Heap
Stack and a Heap ?
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM .
Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and it's allocation is dealt with when the program is compiled. When a function or a method calls another function which in turns calls another function etc., the execution of all those functions remains suspended until the very last function returns its value. The stack is always reserved in a LIFO order, the most recently reserved block is always the next block to be freed. This makes it really simple to keep track of the stack, freeing a block from the stack is nothing more than adjusting one pointer.
Variables allocated on the heap have their memory allocated at run time and accessing this memory is a bit slower, but the heap size is only limited by the size of virtual memory . Element of the heap have no dependencies with each other and can always be accessed randomly at any time. You can allocate a block at any time and free it at any time. This makes it much more complex to keep track of which parts of the heap are allocated or free at any given time.

You can use the stack if you know exactly how much data you need to allocate before compile time and it is not too big. You can use heap if you don't know exactly how much data you will need at runtime or if you need to allocate a lot of data.
In a multi-threaded situation each thread will have its own completely independent stack but they will share the heap. Stack is thread specific and Heap is application specific. The stack is important to consider in exception handling and thread executions.


Sunday, 27 September 2015

Object Oriented Programming Langage Part 2


Object Oriented Programming Langage Part 2

8. What are different access modifiers in .Net?

  • Private - The type or member can only be accessed by code in the same class or struct.
  • Protected - The type or member can only be accessed by code in the same class or struct, or in a derived class.
  • Internal - The type or member can be accessed by any code in the same assembly, but not from another assembly.
  • Procted Internal - The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.
  • Public -The type or member can be accessed by any other code in the same assembly or another assembly that references it.
Note: In VB.Net 'Internal' is called as 'Friend'

11. What is mean by Partial method?

Partial methods are methods defined in a partial class that are (optionally) divided across two files. With partial methods one file contains the method signature - the method name, its return type, and its input parameters - while the body is (optionally) defined in a separate file. If the partial method's body is not defined then the compiler automatically removes the partial method signature and all calls to the method at compile-time.
Example for Partial method
            

   {
       string m_Name;
       public String Name
       {
           get { return m_Name; }
           set { m_Name = value; }
       }
      public  partial  string GetEmpDetails(string ID);
      
    }

    partial class Employee
    {
        int m_Age;
        public int Age
        {
            get { return m_Age; }
            set { m_Age = value; }
        }
       public  partial string GetEmpDetails(string ID)
        {
            return "Employee1";
        }
    }

 
            

12. Why do we go for Partial method?

Partial methods are mainly useful in auto-generated code situations. A code generating tool might know that there are certain extension points that some users are going to be interested in customizing. For example, the objects created in LINQ to SQL have partial methods like OnLoaded, OnCreated, OnPropertyNameChanging, and OnPropertyNameChanged. The auto-generated code calls the OnCreated partial method from its constructor. If you want to run custom code when one of these objects is created you can create a partial class and define the body for the OnCreated partial method.

13. Why do we go for Partial class?

  1. Improve the readability of extremely large classes by partitioning related methods into separate files.
  2. Partial classes enable the code generator to generate code in one file while the developer who may need to extend the auto-generated logic can do so in a separate file, which eliminates the worry that the code generator might overwrite a developer's customizations.

14. Where we use Partial method and class?

Partial classes and partial methods are most commonly used in auto-generated code. It provides a simple and safe way to add new functionality or extend existing functionality of auto-generated code.

15. What are restrictions for Partial method?

  1. Partial definitions must preceded with the key word "Partial"
  2. Method signature should be same in both partial class file
  3. We cannot have partial implementation in one file and another implementation in other file. We can have declaration in one file and implementation in another file.

16. What is mean by Static class?

Static class is used to create attributes and methods that can be accessed without creating the instance of the class. Static classes are loaded automatically by the .NET Framework when application or assembly is loaded. 'Static' key word is used to mention the static class. e.g MyStaticClass.PI
Example for Static Class
            
public static class MyStaticClass
    {
        public static decimal PI = 3.14M;
        public  static int Add(int num1, int num2)
        {
            return num1 + num2;
        }
        public static  string Append(string str1, string str2)
        {
            return str1 + str2;
        }
    }
  MyStaticClass.PI


 
            

17. What is mean by Static method?

Static method can be accessed without creating the instance of the class. 'Static' key word is used to mention the static method. Static methods can be created inside the normal class or static class. If we create the static method inside the normal class, static method will not be able to access by creating instance of the class. e.g Math.Add()

18. Can we override static method?

No, compiler will not allow overriding the static method.

19. What are uses of static class and method?

  1. Compiler will not allow creating the instance of the class
  2. Static class also makes the implementation simpler and faster
  3. Cannot inherit a static class since it is sealed

20. What is static constructor?

A static constructor is used to initialize any static data, or to perform a particular action that needs performed once only. It is called automatically before the first instance is created or any static members are referenced.
Example:
            
public class MyStaticClass
        {
            static int count;

            static MyStaticClass()
            {
                count = 0;
                Console.WriteLine("Static class is initialized");
            }

            public static void MyMethod(string name)
            {
                Console.WriteLine("Static class is initialized " + name);
            }
        }

MyStaticClass.MyMethod("John");

 
            
Output:
Static class is initialized
Hello John