My question might sound too weired and tricky, but is there any way (software/hardware) that I can use to switch between 2 OS without restarting my PC?
Actually I have Windows 7 and Ubuntu installed in my PC.
Well, i can think of two. One, run one of the OSes in a VM. The second is to get another system, and run the second OS on that. You can't switch between OSes without restarting.
If you wanted to save the state of the system, you MIGHT be able to get away with hibernating windows, and starting linux as long as you do NOT write to the windows drive - as you can tell from the answers, do this at your own risk. The other way seems to be safe, however.
If you wanted to build a system that would do this from scratch you'd need a model similar to what the PS3 uses possibly on top of xen or another hypervisor
You can use a virtual machine. One OS (e.g. Ubuntu) hosts another (e.g. Windows) as a guest in a virtual machine. An example is VirtualBox. Your guest OS will be just like another program inside your host OS.
If you had two different OS running as virtual machines under a third operating system, you wouldn't strictly speaking have to restart the PC to switch between them.
kexec allows you to boot a new linux kernel without rebooting your PC.
Currently, it only runs on linux (So it won't work on your particular setup, but would work to boot, for example, fedora from ubuntu).
This proyect seems to be attempting to port kexec to windows, though I've failed to find how much progress they've made. It should be an interesting starting point though.
You could run one of them as a VM in e.g. Virtualbox
The simple answer is no. The only thing close to that is virtualization. You could add a virtualization software to your Windows install (or vice versa), and then convert your current Linux install to a VM (there are tools to convert physical machines into VM's).
Simple answer:no. The OS needs to interact with the hardware, or at least it has to think it is. Without a hypervisor or virtualization system running underneath the OS, managing the hardware/OS interation and the switching, this is not possible with x86 architectures.
Something like xen or kvm lets you switch between virtual machines very quickly and runs them with little overhead.
You can configure a program like Virtualbox or VMware to load your physical XP or Linux install (whichever isn't in use at that time) from within whichever OS you are using.
You can then boot into either OS normally on a reboot.
Ubuntu Forums has a guide on how to boot your physical XP install from within Ubuntu.
VMware Communities has a guide for booting a physical Linux install from within Windows.
Note, you may need to install 2 copies of Grub for this to work. Also, you will most certainly be required to have different hardware profiles for both operating systems and Windows will most likely have to be re-activated when you switch hardware profiles.
There are many ways you can run Windows and Linux distros on the same physical machine without rebooting the PC or notebook, use any of the VMs suggested, including Virtualbox which I am running on my MacbookPro and running both XP and other linux distros, CentOS, Fedora, Mint, Ubuntu, or use KVM or Xen. Check them out and configure your systems to install any one of these as the host and put the guest OS on it.