Blue screen of death

A blue screen of death (also known as the blue screen, bug check, BSOD, or Stop error) is a common name for the screen that occurs during a system crash in Microsoft Windows operating systems. It is shown when the operating system can no longer function safely due to a fatal system error.

Early versions
Contrary to popular belief, Windows 1.0 and Windows 2.x did not have a crash screen. When early Windows is run on a newer version of MS-DOS, it will print out an "Incorrect DOS version" error message, followed by garbled contents of the memory during the boot before loading into the Windows shell, which is often thought to be a crash screen, however, it is only a bug in the logo code. Whenever Windows did crash, it often resulted in a system hang or the shell returning back into DOS.

A modal dialog for displaying important system messages was first introduced in Windows 3.0 and was mostly used by virtual device drivers in 386 enhanced mode. This was a full screen message in text mode, which suspended Windows until being dismissed by the user. Initially, it used a black background, although Windows 3.1 later changed it to blue. The look of the modal dialog was virtually unchanged through the rest of the classic Windows series.

In Windows 3.x, this was mostly used in situations where a program couldn't continue running until the user resolved an issue, such as device conflicts or disk swaps. However, severe system errors still caused Windows to exit back to MS-DOS, similarly to the older versions. The interface was also used for a simple task manager in Windows 3.1, which could be invoked by pressing Ctrl while running Windows in the 386 enhanced mode. The task manager allowed the user to terminate an unresponsive program, or if there's no unresponsive programs, simply allow the user to exit the screen or press Ctrl again to reboot the system. Steve Ballmer wrote the original message for the Task Manager warning.

Windows 9x
Windows 95 and later uses the modal interface to report severe system errors instead of exiting to DOS, which earned it the blue screen of death nickname. Windows 9x is unique in that it allows the user to continue after a system error, although it often resulted in an unstable system. However, some errors (such as /  initialization errors, or Windows Me's temporary "safe to turn off" screen) effectively halt the system. The interface was also used in early Windows 98 builds for ACPI subsystem errors, which notably override the background color to red. Early builds of Windows Me briefly replaced the "It is now safe to turn off your computer" with a blue screen at one point.

Windows NT
On Windows NT, blue screens are also commonly known as STOP errors, referring to the  label that introduced the error code up to Windows 7. According to John Vert, the developer who originally wrote the code in the NT kernel that was responsible for controlling the screen in text mode, the white-on-blue color was chosen in order to match the MIPS' firmware display, as well as the default color scheme of the SlickEdit text editor many NT developers used at the time.

The first known build to implement a blue screen is the October 1991 build. Earlier builds merely print the error code to a debugger, if attached, and trigger a breakpoint in an infinite loop. Originally, a system crash only resulted in the error code being printed out to the screen, although later during Windows NT 3.1 development it was extended to also display the stack trace and a list of loaded drivers and their base addresses.

The message was simplified in Windows 2000 to only include possible instructions for the user should they encounter the blue screen. Thanks to the introduction of a VGA driver in the kernel itself, the blue screen is now also shown in 640x480 graphics mode instead of 80x50 text mode. Due to a bug, the first builds to include this change, including build 1796 and 1814, do not clear the background before displaying the screen, resulting in the error text being shown on a black background or overlaid over the boot screen graphic. The blue screen text was further updated and the font changed to Lucida Console in Windows XP.

During the development of Windows 8, the blue screen underwent many significant changes. Around build 7814, the blue screen was updated to support higher resolutions using VBE 2.0 and anti-aliasing. At first, this updated blue screen only appeared if the system crashed at boot, however, by the time of build 7880 it was used for all bug checks. It would be quickly replaced to a more simplified black screen in build 7899. The screen was redesigned in build 8045 to include a sad emoticon. The background color was later changed to light cerulean in build 8064 and then slightly adjusted in later builds.

In Windows 10 build 14316.1000, a QR code was added to the blue screen, linking to Microsoft's website for diagnosing blue screen errors. Starting by build 14993, the background color was changed to green for Insider builds together with a slight wording change in order to be able to quickly distinguish between Insider and production build bug reports. In Windows 10 May 2020 Update and above, the message was altered to refer to the user's device as opposed to the user's PC.

The default background color for bug checks was changed in Windows 11 build 22000.51 from blue to black, although the green color remained for users in the Insider program. The change was later reverted with build 22000.346, although a darker shade of blue is now used. The QR code was dropped in Windows Server build 22463, but was shortly reinstated.

Implementation
In classic Windows, the blue screen is implemented by the  routine in the Shell VxD. The routine temporarily halts the system and then proceeds to tell the display driver to switch the display to text mode. It sets the background and foreground color, clears the screen and displays the message. It then waits for a valid keypress before switching back to graphics mode and resuming operation. On Windows 9x, it is most commonly called from  in , which displayed the infamous message about an occurring exception. It is possible to change the color of the screen by changing  (background color) and   (text color) values in   (under   section).

The blue screen on NT-based systems is implemented in the  and   functions, which are contained in the kernel executable. The difference between the two functions is that the former accepts only the bugcheck code as an integer parameter, while the latter also accepts four more integers as bugcheck parameter codes, which can have different meaning depending on the bug check code. A component running in kernel mode can call either function to bring the system down in controlled manner if it detects a fatal uncorrectable error that can lead to data corruption. The respective function then takes care of switching to a compatible video mode, rendering the blue screen itself, saving a memory dump, and, if enabled, restarting the system. The colors are hardcoded within the kernel but can be changed using a driver such as NotMyFault.

User mode processes can also trigger a bug check if they hold the shutdown privilege by using the  system call in   with the   flag, which transitions the system to kernel mode and then triggers a   bug check.