Upcoming Posts

Upcoming Posts....

Make your own partition magic software.
How to make an assembler.
What is booting?
Write a simple OS!

‎"I have no special talents. I am only passionately curious." - Albert Einstein

Tuesday, February 28, 2012

Virtual Machine Implementation

Can application software run an operating system? Let me put it in other way, how can ‘VMware’ application executes/loads operating system like Linux? Curious to know, be patient and read this article:

Let me start with the computer fundamental to get you in the context of virtual machine:

Hardware – Computer consists of hardware's like processor, RAM, Hard disk, monitor, keyboard and motherboard which contains chips like BIOS, System timer chip 8054, Interrupt controller 8259 etc.

Software – Operating system (OS) and other software’s like compiler, MS office etc are nothing but a binary file or a set of binary files which contain machine level instructions or opcode (Operation code).

When OS gets loaded into the memory, processor reads instructions and performs operations accordingly. Anything (any machine/person/software) which can follow the instruction mention in binary file(s) can load/execute OS. Isn’t it? Let’s take an example of processor:

Processor: It has several registers used to hold values. Few registers tell processor where the code segment and where the data is in the memory. Using these special registers, processor executes instructions and completes its job. Suppose, the processor reads ‘89D8’ instruction (equivalent to MOV AX,BX assembly code), it will copy the content of BX register into AX register. Similarly, the opcode ‘A0 F4 C4’ (equivalent to MOV AL, [34F4] assembly code) will copy content stored at “34F4” memory address in data segment into AL register.

This is how the processor makes machine and OS usable. Here, you can think that processor is doing nothing but just following the instruction written in OS binaries files. Right?

Now think, can’t we write a program which can behave exactly like a processor? We can write a class to represent a processor and write methods which will perform operations as processor does. The program will work like a processor. Isn’t it? Note that the physical processor is not executing these instructions, a program is doing that. So we can call this program, a ‘virtual’ processor. Can’t we?

Similarly, we can write programs for implementing virtual RAM, Hard disk, monitor, keyboard and motherboard which contains chips like BIOS, System timer chip 8054, Interrupt controller 8259 etc. Combining all these virtual devices will make a virtual machine software like VMWare. Stay tuned for more information on implementation!!!

I hope you’d have enjoyed reading this article. Post your feedback and help me in improving my writing skills/style!

1 comment: