Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: zeugma
Yes, I'm talking to myself. This is a follow-up to my previous comment about MS-Windows crashing after 50 days. Some of you nerds might remember, or at least enjoy it...

This was stolen from this page.

Why Windows 95 and Windows 98 would crash after 49.7 days of uptime

There’s a famous bug in Windows 95 and Windows 98 (now patched) that caused these systems to stop functioning after 49.7 days of uptime. I used to wonder how this happened – in addition to wondering how many Windows 95 / 98 systems could achieve such uptimes to begin with!

Finally, I did a little math and figured out what must be behind this bug. It’s actually quite cute.

First, we need to know about a function called GetTickTime which is part of the Windows API. This function returns a DWORD value representing the number of milliseconds which has elapsed since the system has come up.

What’s a DWORD? A Word on an x86 is 16 bits, so a Double Word is 32 bits. The maximum number expressed in 32 bits is 2 to the power of 32.

2^32 = 4,294,967,296

We’re expressing a number of milliseconds here. How many milliseconds are there in one day?

(milliseconds per second) * (seconds per minute) * (minutes per hour) * (hours per day) = 1000 * 60 * 60 * 24 = 86,400,000.

Finally, we can find out how many days’ worth of milliseconds we can fit in the DWORD:

4,294,967,296 / 86,400,000 = 49.7102696

Voila! After 49.71 days, the number of milliseconds since startup exceeded the maximum value of a DWORD, and rolled to 0 (kind of like the odometer on Al Bundy’s Dodge rolling to 0 after the 999,999,999th mile)

Depending on how you process the return value of GetTickCount(), this may or may not be a problem. Clearly some code in Windows didn’t handle this too well, and Windows hung.

46 posted on 04/20/2018 8:35:23 PM PDT by zeugma (Power without accountability is fertilizer for tyranny.)
[ Post Reply | Private Reply | To 45 | View Replies ]


To: zeugma
> Yes, I'm talking to myself.

Great story, I never knew about that. Mainly because I never had a DOS-based Windows system that managed to accumulate 50 days of uptime.

Windows Server, yes. Win7, yes. Win95/98, not so much.

51 posted on 04/20/2018 10:08:22 PM PDT by dayglored ("Listen. Strange women lying in ponds distributing swords is no basis for a system of government.")
[ Post Reply | Private Reply | To 46 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson