Dnešná relácia otázok a odpovedí sa k nám pridelí zdvorilosťou SuperUser - podskupiny Stack Exchange, zoskupenia webových stránok Otázky a odpovede.
Otázka
Čítačka SuperUser FrozenKing chce vedieť, ako jeho počítač vie, keď havaroval alebo inak mal nesprávne vypnutie. On píše:
Actually, this question struck me because of power cuts in my house. When there is a power cut, there is a sudden loss of power from the computer.
How does the computer know that the shutdown was not properly done?
Je to zaujímavá otázka; jednoznačne moderné operačné systémy si dobre uvedomujú, že sa niečo pokazilo, ale akým mechanizmom si to uvedomujú?
Odpovede
Dodávateľ SuperUser David Schwartz ponúka všeobecnú odpoveď a prehľad o rôznych operačných systémoch:
For non-Windows based PCs, the detection is usually done on a per-filesystem basis. When a filesystem is mounted in read/write mode, an entry is written to the filesystem marking it dirty. When the filesystem is unmounted, an entry is written marking it clean. On startup, the operating system checks if its core filesystems are marked dirty, and if so it knows there wasn’t a clean shutdown - at least of those filesystems.
Ďalší prispievateľ ChrisF odpovedá konkrétnejšie na operačný systém Windows:
When powered off as normal, the bit is switched off. However, in case of power outage or improper (forced) shutdown, the bit will still be on the next time the PC is started.
This means that Windows can suggest remedial action – such as booting into Safe Mode.
In addition a Windows based PC will write an entry into event log detailing when and why (if known) it was shut down. It also writes an event when the PC starts up.
Máte niečo doplniť vysvetlenie? Zvuk vypnúť v komentároch. Chcete si prečítať viac odpovedí od iných používateľov technológie Stack Exchange? Pozrite sa na celý diskusný príspevok tu.