OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Sep 14, 2019 11:57 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Is it safe to do this..? (Mostly about running OS on laptop)
PostPosted: Wed Dec 29, 2010 6:46 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1028
Location: Scotland
I'm fairly sure I have damaged ports in the past by polling them at higher speed than they were designed to withstand. My 486s both crash after eight or nine minutes while running with the interrupts disabled unless a key is pressed from time to time (this happens even while running the simplest possible infinite loop, so it isn't a bug in the program code causing it) - it appears from this that you are expected to run the machine with interrupts enabled and not to rely on polling ports such as the 8042 (keyboard) or the FDC chip (floppy drive control) instead - those are the two chips that I managed to damage/destroy. The FDC chip initially lost its ability to load more than one sector at a time, so I rewrote my OS to get around the problem and continued working with that machine for several months before the chip failed altogether, by which time the 8042 was acting up as well, and that was when I began to suspect that my code was to blame. I added delay loops to avoid future damage of the same kind to other machines.

Someone (ND4) posted up a piece of code here the other day which used rep insw to collect input from a hard drive, and I'm just wondering if that's a safe way to do things. It clearly was safe at one time when processor speeds were low, and maybe it still is safe even now - hard disk speeds have increased in a way that floppy disks have not, so the chips controlling them can necessarily cope with much faster data rates, but it isn't beyond possibility that rep insw is still making them work harder than is good for them.

There are other questions about what is safe which are also bothering me, most of them to do with running an OS on a laptop. If I was to boot a modern laptop with my OS (or indeed one of yours, and obviously I mean run it directly rather than through a simulator like Bochs), would there be any complications resulting from running it on the battery? Does the machine automatically switch off when the charge in the battery is too low, or does it just keep draining it to the point of damaging it? How easy is it to read the power level so that you know when it's running low? Does booting a laptop up with a simple OS from a USB floppy interfere with the OS installed on the hard disk in any way. I don't know if it would prevent a hibernated laptop from unhibernating on the next boot either, but I can't do the experiment to find out until I know if it's safe to run a simple OS on a laptop at all. Has anyone got any experience of running their OS on a modern laptop who can answer these questions, and any other questions that haven't occurred to me which I should have asked?

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Last edited by DavidCooper on Sat Jan 01, 2011 10:30 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Wed Dec 29, 2010 7:12 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 24, 2009 8:11 pm
Posts: 1249
Location: Sunnyvale, California
The battery in a laptop is wrapped up in a lot of protection circuitry that isn't controlled by software: I don't think you can damage it even intentionally. The laptop will turn off when the battery voltage is inadequate to run it, in the same way you would expect of any other battery-powered device, and it will be like a normal power failure. I don't know whether you could run into problems with hibernation, but nobody is going to hibernate their computer and then immediately boot off a USB drive, and even if that happened and the hibernation was disrupted, it would be equivalent to a power failure (just after a disk sync) to whatever OS is hibernating, which shouldn't break anything.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Wed Dec 29, 2010 8:05 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1028
Location: Scotland
NickJohnson wrote:
... nobody is going to hibernate their computer and then immediately boot off a USB drive ...

That's exactly what I would be doing, and often: that's why I'd like to know if it disrupts it. My netbook takes absolutely ages to start up if it has to boot from scratch, so if booting my OS on it from a USB floppy was to disrupt the hiberbation process it would be a real pest. At the moment my OS can't be booted from a USB floppy at all, and although I'm about to change it so that it can, it won't be able to save data or load additional files after switching to 32-bit mode unless I write a lot of extra code to do it all via the BIOS. I intend to write that code regardless, but it isn't the highest priority at the moment as I can manage without it on any desktop machine capable of having an internal floppy drive installed in it. If, however, I knew that it wasn't going to disrupt the dehibernation process, I'd be a lot more keen to write the BIOS-using code sooner rather than later as it would be useful to be able to run my OS directly on my netbook, just so long as it doesn't make it a lot more inconvenient to switch back to using Windows afterwards. I could do the experiment right now by trying to boot it with MS-DOS, but I'm not sure that it's safe to do so, and that's why I'm hoping for answers from someone who has experience of doing this kind of thing already.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 12:40 am 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2565
Location: Sydney, Australia (I come from a land down under!)
Quote:
The FDC chip initially lost its ability to load more than one sector at a time, so I rewrote my OS to get around the problem and continued working with that machine for several months before the chip failed altogether, by which time the 8042 was acting up as well, and that was when I began to suspect that my code was to blame.

Have you considered that the chip might just be very, very old and finally deciding to die?

I'm not saying it's impossible to break these chips with your code, but I'd be making sure the hardware isn't just degrading to the point of failure.

Quote:
It clearly was safe at one time when processor speeds were low, and maybe it still is safe even now - hard disk speeds have increased in a way that floppy disks have not, so the chips controlling them can necessarily cope with much faster data rates, but it isn't beyond possibility that rep insw is still making them work harder than is good for them.

If you're honestly concerned about this, use DMA. Then you can be worried about the DMA chip reading and writing too fast and have something to blame that isn't your code.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 8:44 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9284
Location: On the balcony, watching the Swedish Chef
Quote:
My 486s both crash after eight or nine minutes while running with the interrupts disabled unless a key is pressed from time to time

I have an old i486 machine (Am5x86) that comes with a watchdog timer: if you don't do anything over a long period of time it will shut itself down. Essentially it's the machine's way of protecting itself and the attached equipment from you for writing a "broken" OS. (think about overheating, screensaving for old CRTs)

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 3:25 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1028
Location: Scotland
pcmattman wrote:
Have you considered that the chip might just be very, very old and finally deciding to die?

That may be the case, but I was polling the ports tens of thousands of times faster than necessary to collect the data, and it seems likely that they were not designed to be able to handle that.

Quote:
If you're honestly concerned about this, use DMA. Then you can be worried about the DMA chip reading and writing too fast and have something to blame that isn't your code.

The DMA's speed is dictated by the FDC through a mechanism that doesn't involve it pestering the FDC in an aggressive manner. I will be using the DMA soon, but I thought it was worth bringing to people's attention the possibility that primitive ways of using the hardware may no longer be safe. I don't know if rep insw is inherently safer in the way it works - I have no idea how it knows when there's new data waiting to be collected or when it's time for it to post another word to the port, so it's quite possible that it would do no damage even with the slowest of hard drives and fastest of CPUs. I don't intend to use it as I will be using the DMA instead, but anyone who is using a primitive method of controlling the hardware which hasn't been used by MS-DOS or any serious operating system that's come along since needs to be aware that they aren't necessarily using the hardware in the way it was designed to be able to withstand, and they should alert others to any equipment failures which may be caused by using primitive methods.



Combuster wrote:
I have an old i486 machine (Am5x86) that comes with a watchdog timer: if you don't do anything over a long period of time it will shut itself down. Essentially it's the machine's way of protecting itself and the attached equipment from you for writing a "broken" OS. (think about overheating, screensaving for old CRTs)

That's interesting. I wonder if it's programmable. Does it only shut the machine down if the interrupts are disabled or does it do so even if they are enabled? Mine do not crash if left idle for hours with the interrupts running (whether it's the real mode interrupts or my own interrupts in protected mode).

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 4:47 pm 
Offline
Member
Member
User avatar

Joined: Fri Jun 13, 2008 3:21 pm
Posts: 1700
Location: Cambridge, United Kingdom
"rep insw" is no different from executing an in instruction in a loop. It will perform back-to-back reads from the IO port.

I have a different suspicion. You say you run your OS on 486 machines. What clock rate does the ISA bus run at on the machine with the failed components? It is notable that it was around this time that "ISA" was defined as a standard with a designated clock rate (8MHz), and that many machines would have ISA buses which were out of spec. Indeed, some 386 machines were known to run the legacy components out of spec (Hence the belief among many that you need some form of delay between accesses to the legacy devices, which is not true for anything of Pentium vintage or later) and I'm wondering if your 486 did too. It is plausible that, if this is the case, then the lifetime of the components would be shortened (and it is possible that back to back accesses at higher frequencies than the device was designed for have contributed to this - but note that in the end the fault lies with the motherboard manufacturer)

As for reading the battery level, there are two ways you could do this:
  • ACPI. This requires you to write one driver, albeit horrendously complicated, for all machines. Note that there are known to exist somewhere between 1 and 3 implementations of ACPI. 1 by Intel, and maybe ones by Apple and Microsoft (not having access to their sources and not having reverse engineered them, it is impossible to say if those are derived from Intel's). If you programmed in C (or a compatible language), you could use Intel's implementation; since you don't, well.. good luck.
  • Machine specific drivers. One comparatively simple driver per machine type. Of course, there are lots of machines.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 5:49 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 07, 2007 1:45 pm
Posts: 1401
Location: Eugene, OR, US
There is no need to be wishy-washy here. Your components died for some other reason. It is completely impossible to damage a component by performing IN opcodes, no matter how many or how often. Your IO bus has internal motherboard timing mechanisms that slow it (and your CPU) down enough to match the speed of any component whenever you do an IN. Polling with interrupts off is always legal. If your hardware fails in that mode, then your hardware is flaky. REP INSW is a smart way to get PIO data from an ATA disk.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 10:49 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2423
Location: Canada
Owen wrote:
[*]ACPI. This requires you to write one driver, albeit horrendously complicated, for all machines. Note that there are known to exist somewhere between 1 and 3 implementations of ACPI. 1 by Intel, and maybe ones by Apple and Microsoft (not having access to their sources and not having reverse engineered them, it is impossible to say if those are derived from Intel's). If you programmed in C (or a compatible language), you could use Intel's implementation; since you don't, well.. good luck.

OpenBSD has it's own original ACPI implementation, and suspend/resume works on my fancy new 2010 laptop.

As others have said David, the possibility of hardware damaging a floppy drive by accessing it "too quickly" is absurd, especially considering how difficult it was for developers of that time to get documentation (..lots of trial and error).

I have owned several 286/386/486 and beyond systems, and while I do have a few defective drives.. the issues were almost always caused by age, condition (..dirty), and mechanical wear and tear.

There would definitely be restrictions in place to prevent a drive to be damaged in that way, you may also want to consider how unreliable floppy media is.. in combination with the drives.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
UNIX&BSD's, your only aspirations, to be imitated! 8)
Windows, are an opening in an otherwise solid and opaque surface through which light and, sometimes, even air can pass through; nothing more.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Thu Dec 30, 2010 10:57 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2423
Location: Canada
As for "hibernation" it's essentially just putting devices into a different power mode, saving state, and reinitializing on resume.

If you power down or reboot a system that's in hibernation, all kernel and userland state is lost and the hardware is in a powered down state.. the BIOS will simply reinitialize the hardware and it will be as if you just started the system.

Your system will remain on and uninterrupted until you write support for this, and if things get too hot.. which only happens if you're using inadequate cooling.. it'll power off.

Newer hardware has a lot of safety protection these days, CPU's have internal circuity that automatically power them down if they overheat.. and all legacy I/O devices are now implemented in a "SuperIO" ASIC that can withstand abuse.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
UNIX&BSD's, your only aspirations, to be imitated! 8)
Windows, are an opening in an otherwise solid and opaque surface through which light and, sometimes, even air can pass through; nothing more.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Sat Jan 01, 2011 1:01 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1028
Location: Scotland
Owen wrote:
"rep insw" is no different from executing an in instruction in a loop. It will perform back-to-back reads from the IO port.

I have a different suspicion. You say you run your OS on 486 machines. What clock rate does the ISA bus run at on the machine with the failed components? It is notable that it was around this time that "ISA" was defined as a standard with a designated clock rate (8MHz), and that many machines would have ISA buses which were out of spec. Indeed, some 386 machines were known to run the legacy components out of spec (Hence the belief among many that you need some form of delay between accesses to the legacy devices, which is not true for anything of Pentium vintage or later) and I'm wondering if your 486 did too. It is plausible that, if this is the case, then the lifetime of the components would be shortened (and it is possible that back to back accesses at higher frequencies than the device was designed for have contributed to this - but note that in the end the fault lies with the motherboard manufacturer)

I acquired the machines second hand long ago, and I think I remember something now about the one that went wrong originally being a 386 that had been upgraded to a 486 - that may account for the problem.

Quote:
As for reading the battery level, there are two ways you could do this:
  • ACPI. This requires you to write one driver, albeit horrendously complicated, for all machines. Note that there are known to exist somewhere between 1 and 3 implementations of ACPI. 1 by Intel, and maybe ones by Apple and Microsoft (not having access to their sources and not having reverse engineered them, it is impossible to say if those are derived from Intel's). If you programmed in C (or a compatible language), you could use Intel's implementation; since you don't, well.. good luck.
  • Machine specific drivers. One comparatively simple driver per machine type. Of course, there are lots of machines.

I should probably wait and worry about that later - if the machine switches off without warning it isn't likely to matter much, and I'll have a fair idea when it's likely to conk out anyway. I should probably get a new netbook with longer battery life to run my OS on (my current one's officially two hours but tends to go in half that) - I imagine that the 11 hour ones can probably manage 5 or 6 in real life, although it's possible that an OS needs to play tricks with the hardware to make the battery last longer, and mine obviously won't be doing that. Even so, if it can do two or three hours that will be useful enough.





bewing wrote:
There is no need to be wishy-washy here. Your components died for some other reason. It is completely impossible to damage a component by performing IN opcodes, no matter how many or how often. Your IO bus has internal motherboard timing mechanisms that slow it (and your CPU) down enough to match the speed of any component whenever you do an IN. Polling with interrupts off is always legal. If your hardware fails in that mode, then your hardware is flaky. REP INSW is a smart way to get PIO data from an ATA disk.

Well, it's good to hear that sort of confidence - I've been a little worried about running my OS on anything other than expendable old machines in case it damages them, but it sounds as if it should be safe to run it on more expensive top-of-the-range kit, which is what I've always wanted to do with it but never dared.





Brynet-Inc wrote:
OpenBSD has it's own original ACPI implementation, and suspend/resume works on my fancy new 2010 laptop.

I've just had a look at an ACPI document of about 700 pages which is surprisingly well written - makes it sound possible to do some of it. Even so, it's never going to be enough of a priority for me and the whole game will have changed in any case before I could get up to speed with it: supercapacitors may soon be able to provide an alternative to batteries that will allow you to charge laptops in a few seconds, and that'll make it really easy to get them topped up. In the lab they've now got some that equal NiMH for storage capacity per weight.

Quote:
...you may also want to consider how unreliable floppy media is.. in combination with the drives.

I've actually been astonished at how reliable floppies are, loading and saving faultlessly for years with my OS even though throughout most of that time it wasn't programmed to look for errors and to go back to try again if it found any.






Brynet-Inc wrote:
As for "hibernation" it's essentially just putting devices into a different power mode, saving state, and reinitializing on resume.

If you power down or reboot a system that's in hibernation, all kernel and userland state is lost and the hardware is in a powered down state.. the BIOS will simply reinitialize the hardware and it will be as if you just started the system.

So it undoes it all even if you don't touch the hard drive. That's a pity - sounds as if they missed a trick there as it would be really useful to be able to hibernate an OS and unhibernate another one from a different partition.

Quote:
Your system will remain on and uninterrupted until you write support for this, and if things get too hot.. which only happens if you're using inadequate cooling.. it'll power off.

Newer hardware has a lot of safety protection these days, CPU's have internal circuity that automatically power them down if they overheat.. and all legacy I/O devices are now implemented in a "SuperIO" ASIC that can withstand abuse.

Okay. Thanks for the reassurance, and to everyone else for the same - I'm now happy to do the experiments for myself and to risk running my OS on new equipment. It'll be useful to be able to show people what it does, and without having to do it through Bochs where it doesn't look like a real OS to those who don't know what Bochs is (though my OS still isn't quite ready for either option as I haven't yet sorted the loading problems - I'm half way there now having dealt with a whole lot of things which needed to be radically rearranged before it was worth writing the code that will load it all via the BIOS).

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Sat Jan 01, 2011 1:32 am 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2565
Location: Sydney, Australia (I come from a land down under!)
Quote:
So it undoes it all even if you don't touch the hard drive. That's a pity - sounds as if they missed a trick there as it would be really useful to be able to hibernate an OS and unhibernate another one from a different partition.

I used to hibernate my Linux installation all the time to reboot into Windows without losing my place in my IDE and such.

The problem is determining what you mean by hibernation: a full shutdown with fast restore (with all previous system state)? Or a mere sleep mode? The former stores all system state and memory in a file (on Windows, hiberfil.sys) and shuts down the computer. On the next boot of Windows this state is restored. If you use something such as GRUB however you can boot to a different OS, or use the BIOS to boot to a different disk (or LAN, perhaps).

A sleep mode on the other hand is just an extremely low power state - the system is not actually off at all. Removing power during sleep will cause you to lose data, and you can't boot off a different disk when returning from a sleep mode.

Typically hibernation is referred to as the S4 power mode and sleep as the S3 power mode: ACPI wikipedia page.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Sat Jan 01, 2011 3:59 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

DavidCooper wrote:
Does booting a laptop up with a simple OS from a USB floppy interfere with the OS installed on the hard disk in any way. I don't know if it would prevent a hibernated laptop from unhibernating on the next boot either, but I can't do the experiment to find out until I know if it's safe to run a simple OS on a laptop at all.


pcmattman wrote:
I used to hibernate my Linux installation all the time to reboot into Windows without losing my place in my IDE and such.


I'd assume this might only work if the BIOS is unable to determine that a different OS was booted. If anything that the "hibernated" OS could've relied on may have changed (including software, files, partitions, etc that could've been changed by a different OS, or hardware that could've been changed when the computer was off), then the "hibernated" OS's saved state can't be relied on and might be discarded.

The ACPI specs actually say (highlighting mine):

"When the system leaves the Soft Off or Mechanical Off state, transitioning to Working (G0) and restarting the OS, a restore from a NVS file can occur. This will only happen if a valid non-volatile sleep data set is found, certain aspects of the configuration of the machine have not changed, and the user has not manually aborted the restore. If all these conditions are met, as part of the OS restarting, it will reload the system context and activate it. The net effect for the user is what looks like a resume from a Sleeping (G1) state (albeit slower). The aspects of the machine configuration that must not change include, but are not limited to, disk layout and memory size. It might be possible for the user to swap a PC Card or a Device Bay device, however.".

For example, changing the BIOS options (e.g. to boot from USB floppy instead of the hard disk) may or may not be included in "aspects of the machine configuration that must not change".

Basically what I'm saying is that it may or may not work in specific hardware in specific circumstances; and the only reliable way DavidCooper can determine what happens on his laptop in his circumstances is for DavidCooper to try it on his laptop in his circumstances. ;)

DavidCooper wrote:
Does booting a laptop up with a simple OS from a USB floppy interfere with the OS installed on the hard disk in any way.


If the simple OS from the USB floppy contains malicious code to fill all hard disks with trash, then I'd assume booting that simple OS would intefere with the OS installed on the hard disk in some way... :)


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Sat Jan 01, 2011 6:02 pm 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2565
Location: Sydney, Australia (I come from a land down under!)
Quote:
Basically what I'm saying is that it may or may not work in specific hardware in specific circumstances; and the only reliable way DavidCooper can determine what happens on his laptop in his circumstances is for DavidCooper to try it on his laptop in his circumstances. :)

I think this is the most important point: a lot of what we do in OSDev comes from trying something first and finding out it doesn't work. There's no way we can accurately specify what will happen with respect to rebooting from hibernation into a different OS in DavidCooper's environment - this is something only David can find out.

And for the most part, trial and error with things such as hibernation and boot disks is safe (once you start using trial and error to reverse engineer hardware, or start testing writing to a disk however...).

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject: Re: Is it safe to do this...?
PostPosted: Sat Jan 01, 2011 10:20 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1028
Location: Scotland
pcmattman wrote:
The problem is determining what you mean by hibernation: a full shutdown with fast restore (with all previous system state)? Or a mere sleep mode? The former stores all system state and memory in a file (on Windows, hiberfil.sys) and shuts down the computer. On the next boot of Windows this state is restored. If you use something such as GRUB however you can boot to a different OS, or use the BIOS to boot to a different disk (or LAN, perhaps).

It sounds from that as if the next booting of Windows should still be able to recover the Windows hibernation data and enable it to unhibernate, which is what I'm hoping will happen. I don't need to hibernate my own OS as it wouldn't save any time anyway, but presumably any OS can store a hiberfil kind of file and use it to set up the machine instead of doing a normal boot from scratch, so it may well be possible to hibernate as many OSes as you have on the machine and keep them in that state all at the same time.

Quote:
A sleep mode on the other hand is just an extremely low power state - the system is not actually off at all. Removing power during sleep will cause you to lose data, and you can't boot off a different disk when returning from a sleep mode.

Sleep mode on the other hand isn't going to lead to a reboot of any kind, so you're always going to continue from where you left off with whichever OS is active. The battery's still going to run down fairly fast, but it's useful for stopping work from time to time to have short conversations with people. I don't know how easy it would be to do this from my own OS as it may have to do something via ACPI to get into sleep mode unless sleep mode has already been tied to the power button instead of hibernation, and even then I don't know if either system will work just through pressing the power button alone. I'll have to try it to find out
(and hopefully I'll be ready to do that in a few days).




Brendan wrote:
I'd assume this might only work if the BIOS is unable to determine that a different OS was booted. If anything that the "hibernated" OS could've relied on may have changed (including software, files, partitions, etc that could've been changed by a different OS, or hardware that could've been changed when the computer was off), then the "hibernated" OS's saved state can't be relied on and might be discarded.

My aim is to avoid using the hard drive altogether to begin with, though later on my OS could store stuff in a partition that Windows doesn't use. Even then I would probably boot it from one of those flash drives that pretends to be a floppy disk rather than trying to make it a dual boot machine, unless I'm overestimating the difficulty of creating a dual boot system. Anyway, I can't see that it would be changing anything of importance, so hopefully it will work fine.

Quote:
"The aspects of the machine configuration that must not change include, but are not limited to, disk layout and memory size. It might be possible for the user to swap a PC Card or a Device Bay device, however."

For example, changing the BIOS options (e.g. to boot from USB floppy instead of the hard disk) may or may not be included in "aspects of the machine configuration that must not change".

That shouldn't be a problem if the machine's been set up to boot from USB floppy before being hibernated, which it would be anyway. It would then boot my OS , run it for a time, then I'd power it off (or the battery would run out), and then the next time it boots it would hopefully be in the same state it was before I ran my OS on it, from the point of view of Windows at least. I'll let you know how it actually goes when I try it out (assuming I can work out how to set the machine to boot from a floppy, though I expect it's set up to do that already in case Windows needs to be repaired).

I am surprised there aren't lots of replies from people saying they run their own OS on a laptop and that it does/doesn't affect the hibernated Windows/other that they run on it as well, but maybe they just aren't reading this thread because the title's so non-specific. I'll try modifying it a little.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], nullplan and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group