Page 1 of 1
Creating A virtual OS
Posted: Wed Aug 08, 2012 8:59 am
by eskimo456
Hi there I am new to OS programming and am looking at different things.
I was wandering are there any design and theoretical differences between a virtual OS and a non virtual OS. If I wanted to create an OS that was able to run parallel with the windows operating system would I require certain knowledge or low level functionality of windows?
Also how can effectively two Operating systems allocate a single systems hardware and resources without reporting errors?
Many thanks
I apologies if these answers require a lot of information and are seemingly simple. If it is unreasonable to answer these questions in a forum if someone could point me towards an academic paper or similar resource that would help that would be very much appreciated
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 10:09 am
by NickJohnson
You can run a normal, unmodified OS in a virtual machine under any other. That's the whole idea of a VM. Developing an OS to run under a VM is the same as developing one to run under real hardware.
The degree to which resources can be shared by the host and guest OSes depends on the VM software and whether the computer supports things like PCI passthrough (which allows a guest OS to control a real hardware device directly.)
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 1:47 pm
by eskimo456
Thanks for the fast reply.
So if I was to create my own custom virtual machine I could then have my own OS that runs within it?
I have started looking at
http://www.codeproject.com/Articles/431 ... al-machine for advice on how to make my own virtual machine.
Would it be easier to build a basic Kernel on a separate machine first? Or would creating one in a VM be easier as the already created OS handles a lot of required hardware functionality.
Many thanks
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 1:51 pm
by rdos
NickJohnson wrote:You can run a normal, unmodified OS in a virtual machine under any other. That's the whole idea of a VM. Developing an OS to run under a VM is the same as developing one to run under real hardware.
That's the general idea, although it is not quite true. Various virtual machines have their special quirks. Microsoft's virtual PC for instance does not allow graphic guest OSes that aren't Microsofts own, they install their own "addons" in order to provide better interoperability with their own products. It is also common to virtualize networks by requiring support for some ancient network-card. Bochs has some serious issues for OSes that were once developped on real hardware rather than on emulators.
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 2:50 pm
by NickJohnson
You're confusing a virtual machine that emulates real hardware (like QEMU or VirtualBox) and a virtual machine that runs some sort of bytecode (like the Java VM.) OS development is usually done within a virtual machine that emulates the hardware that the OS is intended to run on, because it's much faster to reload/reboot a VM than a real machine. You don't develop the VM along with the OS (in the sense that you don't develop a VM with a specialized guest OS; developing a VM implementation for a host OS is perfectly sensible, although porting one would be much easier,) because a good OS should run under any VM and a good VM should run any OS. You can't write an OS for something like the Java VM, at least not without major extensions to the VM itself so that it will run on bare hardware, which makes the project more writing a kernel that runs Java bytecode than an OS under a VM; that sort of thing has been done successfully, however.
You seem to either have some fundamental misunderstandings about how an OS works, or are trying to write something very radical and probably not very useful.
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 4:02 pm
by eskimo456
Thanks a lot for all the advice. I am very new to operating system and have only just started reading about Kernel development and assembly language. I am more interested for my own curiosity into how the computer actually functions at a low level. I have experience programming in higher level languages primarily as C++ and C#, however my knowledge of processors, hardware and assembly has big gaps in it.
I have had a look at virtualBox. Is the idea to use VirtualBox as it is, since it is already able to emulate the hardware, and create an OS and load it through the VM.
The reason I am looking at the virtual machine is purely out of curiosity, since Windows is able to run on Mac using this system. All the information and tutorials I have found so far only describe the theory of how to create an OS direct on the hardware (primarily using GRUB), but I haven;t come across anything about virtual hardware.
Is a virtual OS almost identical to a standard OS and then just loaded through the VM, or are there some fundamental differences to the design and code structure?
Sorry if these questions seem naive.
Many thanks
Re: Creating A virtual OS
Posted: Wed Aug 08, 2012 4:51 pm
by blm768
eskimo456 wrote:
Is a virtual OS almost identical to a standard OS and then just loaded through the VM, or are there some fundamental differences to the design and code structure?
There aren't really "virtual" and "non-virtual" versions of the OS. The VM makes the OS "think" that it's running on the real hardware, so all the techniques you would use for making an OS for direct hardware use apply to making an OS to run in a VM. That's why you can run Windows inside a VM without modifying it.