How does Windows know it crashed?

Status
Not open for further replies.

us3rnotfound

Diamond Member
Jun 7, 2003
5,334
3
81
The PC in question will lockup completely, no mouse/keyboard input possible and the hdd led is completely off.

It is not overheating. It is an Intel 945 platform running Windows XP. Memtest86+ shows the memory is good.

My original question is, if Windows experiences a problem and it cannot shutdown nicely, how does it know on next boot if it needs to ask to go into safe mode? I ask because this PC will boot to Windows after a freeze up as if it shutdown properly last time. Ghost file?

Thanks in advance, I know I'm being really unspecific but I'm trying to narrow it down.
 

jimmybgood9

Member
Sep 6, 2012
59
0
0
Data is not always written to HDDs immediately as it may be busy on another project. The data, then, waits in memory until the HDD has time to deal with it. When you shut down the computer in an orderly fashion, the disk cache is flushed from memory and Windows makes a notation on the filesystem that it is in a consistent state. That is, that all files that were supposed to be written to disk indeed have been written.

If, when the computer is restarted, Windows doesn't see this notation on the filesystem, it knows that the the box was not shut down cleanly. It is interesting that the HDD activity light is inactive. Perhaps the system is unmounting the filesystem. I'm just guessing, though, but I think I did answer your question, though there may be other ways that Windows knows when it has been properly shutdown.
 

ericloewe

Senior member
Dec 14, 2011
260
0
76
I always assumed Windows wrote its state to a file that is read on boot, so that it can distinguish between an unknown error, a BSOD and a regular shutdown.
 

Ferzerp

Diamond Member
Oct 12, 1999
6,438
107
106
Umm.... What kind of question is this? It logs when it boots. It logs when it shuts down. If it hasn't logged a shutdown since last boot, it wasn't shut down gracefully..... It also logs when it starts to boot, and logs when the boot is complete and so knows if the last boot was completed or failed.
 

jimmybgood9

Member
Sep 6, 2012
59
0
0
Umm.... What kind of question is this? It logs when it boots. It logs when it shuts down. If it hasn't logged a shutdown since last boot, it wasn't shut down gracefully..... It also logs when it starts to boot, and logs when the boot is complete and so knows if the last boot was completed or failed.

What makes it an interesting question is that the computer locks up and then boots up as if it had been shutdown properly.
 

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
What makes it an interesting question is that the computer locks up and then boots up as if it had been shutdown properly.
If if the FS is in a clean state, there shouldn't be any need to worry, so I don't think they bother, except for servers. IOW, if it locked up after a successful bootup, with a clean journal, no shadow copies, no in-progress installations or uninstallations, etc., then there should be no reason to do anything but start up normally. Doing otherwise hassles the user, but provides no benefits.

If it failed to boot, or crashed with any important operations pending, that could be a problem warranting a chkdsk, safe mode startup, etc..
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
Windows writes constantly to a drive when running and some of those files are lock type files. Locks are things windows writes to a system file for every file that is in use to keep other applications from changing the content in a way that harms the system stability. Ever gotten a "file is in use" error when deleting something ? That is the lock file at work.
If windows boots and finds lock files that were not removed it will determine that the system was not shut down correctly.
 

pitz

Senior member
Feb 11, 2010
461
0
0
Most computers have what's known as a "watchdog timer", which, if not reset by the operating system after a certain interval, will automatically initiate the reboot sequence.

So obviously if the operating system kernel crashes or otherwise gets itself into an undesirable state -- the periodic signal that is required to be sent to the watchdog timer, will fail to reset.
 
Status
Not open for further replies.