Jump to content

why do we need to restart to change OSes?


Soündless
 Share

22 posts in this topic

Recommended Posts

hmm....

 

we would need to hack shutdown (either in bios, or in the operating system) so that instead of powering down, it simply shuts down one operating system and starts up the boot loader again.

 

how slow is virtualization? could you write a super-simple OS whose sole job is to act as a shell for the virtualization of operating systems?

Link to comment
Share on other sites

if you think about it, an EFI shell should be able to do this.

 

Some of us will remember when syslinux or loadlin were popular ways of loading linux from within a running windows install, likewise the BeOS 4 demo that was distributed some years ago booted from a windows .exe.

 

I see no reason why apps could not be written that would do something similar now, although they'd have to have some pretty hefty low-level permissions to wipe one of today's OS'es from memory & boot up another.

Link to comment
Share on other sites

I suppose if you could copy everything currently in the RAM/Memory to a temporary file, it could work? So when it comes to loading it back up again, it just places everything in from that temporary file into the memory?

Link to comment
Share on other sites

I suppose if you could copy everything currently in the RAM/Memory to a temporary file, it could work? So when it comes to loading it back up again, it just places everything in from that temporary file into the memory?

 

yea.

 

You would also (probably) have to fine the location of the virtual memory and protect that. Say you have 26GB of virtual memory, and 2GB of RAM. the "restart" application would do this to switch from Mac to Windows:

 

first, it quits all other applications. Then, it finds the location of the virtual memory, and saves the used portion as a file (it wouldn't have to touch the data, just add an entry to the filesystem). Then, it copies all data in active and wired memory (real RAM) to the end of this virtual memory file, makes a separate entry for this in the filesystem. It would also have to save the state of all active processes. then, it wipes the memory (except for itself), and calls the boot sector efi file (assuming you have pc_efi). From there, you can start up x64 Windows.

 

After having my computer on for several days, I have 660 MB total of "Wired" and "Active" memory. about 410 MB of that is user processes (BOINC, XCode, firefox, Mail, etc.). So, this restart app would have to copy about 250MB of RAM data to the hard drive. I can write at 72MB/sec, so It would take about 4 seconds to copy the contents of the memory to hard drive. Inactive memory does not matter, because it is simply left over from other apps you have already closed (or so Help says).

 

To go from Windows to Mac, it would quit all processes, then wipe the memory, then loads the OS X data back into RAM, and restore all processes.

 

You would have to write it in Assembly, and at a hardware level. It would have to be operating system independent, and use no OS calls. You would probably have to make an app or .exe to launch it.

 

 

I should stop right now. I'm going to f*ck up my operating system beyone all usability.....

 

 

 

As long as you stay away from system files, you shouldn't damage anything. You would have to unmount all volumes somehow....

 

=======

 

So, what we have to do:

 

save virtual memory as a (huge) file

 

copy active and wired memory to disk, save it as a file

 

save the state of all processes, and stop them

 

call efi boot sector file (for osx86 pc_efi computers), startup windows.

 

 

 

If you did it this way, you could boot back to where you left off.

 

 

=======

 

or:

 

you could just quit all processes

 

wipe the memory

 

call the efi file.

 

 

 

this would be much easier.

Link to comment
Share on other sites

loli got caried away. this would be much easier:

 

you could just quit all processes

 

wipe the memorycall the efi file.

 

This would save me about a minute of boot time.

 

 

 

 

 

As I was thinking about it, I realized something;You don't even need to wipe the memory. If there are no processes that remember data is in the memory, then it doesn't matter that its there. When you start up the next OS, it will be overwritten like nothing is there.I was playing with how to quit processes.

 

sudo -s (switch to root) <press enter>

 

ps -cax <press enter> (lists all processes, including there process id (pid) and their name)

 

kill -9 <pid <press enter> (kills a process)I did "kill -9 191". 191 was the second launchd.

 

After doing that, terminal froze (along with its menu bar). Sweet! But, i couldn't kill the first process (1) for some reason..... no permission I guess, even as root. also, the app switcher (Apple-tab), the force quit menu, and exposé don't work.

 

this is on my iMac.

 

EDIT: darn, after about 2 minutes, everything came back (after I force-quit terminal from activity monitor)

Link to comment
Share on other sites

  • 3 weeks later...
If you're spending 40-60 seconds in BIOS, there's something wrong with your machine.

 

My time spent in BIOS: 17 seconds.

 

He obviously means the time spent booting the Operating System as well... :D

 

Oh, ok - nevermind then. ;)

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I didn't get the plot of the thread either... Are you talking about Virtualization Machines? How do they switch from one OS to another?

Running BootCamp you need to reboot your system to switch to another OS.

With Parallels and Fusion you don't need to reboot.

Link to comment
Share on other sites

Im curious to see hows the behavior of a 8gigs ram + mac pro 8 cores run and deal with the virtualization

its going to be the native speed, like as we boot the windows from bios right?

 

I think with the improvements of virtualization and hw, the host machine will deal fine with guest, and the guest will act as full loaded realtime os. And its the dream of ms for windows7 right? But I think this is gonna happen or at least be damn hot useful for us mac/hackintosh users.

Link to comment
Share on other sites

Of course it can be done, but you need that the OS´s in question have this ability built-in. The problem as I see it is that this can be a security threat if not done properly as this hook or gate or whatever you choose to do this will have to be running (on the x86) at lower than ring 3. And that would make it vulnerable for viruses etc. A better option is one hybrid. You could i.e. hibernate the computer (write the state to disc) use bios or efi (i guess legacy bios are too limited) to change running state of computer, then restart the cpus only and run an efi switch application which loads the hibernation of the other os, or if not existing - starts it up.

Link to comment
Share on other sites

 Share

×
×
  • Create New...