La séance de questions et réponses d’aujourd’hui nous est offerte par SuperUser, une sous-division de Stack Exchange, un groupe de sites Web de questions-réponses animé par la communauté.
La question
Lecteur superutilisateur FrozenKing souhaite savoir comment son ordinateur sait s’il est tombé en panne ou s’il a eu un arrêt incorrect. Il écrit:
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?
C’est une question intéressante; Il est clair que les systèmes d’exploitation modernes savent bien que quelque chose ne va pas, mais par quel mécanisme sont-ils informés?
Les réponses
David Schwartz, contributeur à SuperUser, offre une réponse générale et un aperçu des différents systèmes d'exploitation:
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.
Un autre contributeur, ChrisF répond plus spécifiquement pour le système d'exploitation 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.
Avez-vous quelque chose à ajouter à l'explication? Sound off dans les commentaires. Voulez-vous lire plus de réponses d'autres utilisateurs de Stack Exchange doués en technologie? Découvrez le fil de discussion complet ici.