Why Windows Once Had Special Code To Protect It From ‘Stray Gamma Rays’

Why Windows Once Had Special Code To Protect It From ‘Stray Gamma Rays’
Image: MaxPixel

I don’t think anyone, not even a programmer working on Windows, could list all the crazy workarounds and hacks that exist in the operating system’s code base. That said, from time to time, we do find out about one or two. Take the incredible, though temporary, patch that would protect the CPU cache from “stray gamma rays”. Sounds more like a conspiracy theory, but it’s completely true.

Microsoft’s Raymond Chen relayed the anecdote last week. Apparently, it was possible for the processor cache to become corrupted when coming out of standby, thanks to “flipped … bits”… from gamma rays.

The fix was to invalidate the cache using a command called invd. That’s it.

Although the code has since been disabled, Raymond says, the comment for it is still there. The funny part is, it wasn’t even Microsoft that wanted the change, as the comment explains:

Honestly. The processor manufacturer asked for this. I’m serious.

This “fix” lasted less than a month. It wasn’t even an unusual request, apparently:

One of my colleagues wasn’t part of this specific change, but recalled that these sorts of strange-sounding requests were not uncommon, especially for early processor steppings. The workaround was removed once the problem was fixed in microcode or in a later processor stepping.

So, if you’re now concerned your PC could be damaged by a random gamma blast, feel free to make a little aluminium hat for it.