Creating A virtual OS

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
eskimo456
Posts: 9
Joined: Wed Aug 08, 2012 8:52 am
Location: United Kingdom

Creating A virtual OS

Post 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 :)
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Creating A virtual OS

Post 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.)
eskimo456
Posts: 9
Joined: Wed Aug 08, 2012 8:52 am
Location: United Kingdom

Re: Creating A virtual OS

Post 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
rdos
Member
Member
Posts: 3297
Joined: Wed Oct 01, 2008 1:55 pm

Re: Creating A virtual OS

Post 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.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Creating A virtual OS

Post 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.
eskimo456
Posts: 9
Joined: Wed Aug 08, 2012 8:52 am
Location: United Kingdom

Re: Creating A virtual OS

Post 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
blm768
Member
Member
Posts: 45
Joined: Fri Jun 29, 2012 11:32 am

Re: Creating A virtual OS

Post 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.
Post Reply