system
Given the following post, respond as if you're commenting on Reddit:
human
How are electronic systems on spacecraft protected from "bit flips" caused by cosmic rays?
gpt
A number of ways, depending on a lot of factors. There are two categories of protection- physical and logical.

Physical protections are things like:

* Larger feature (transistor) sizes, as larger circuit elements need more energy to flip.
* Radiation resistant materials, meaning building circuit elements out of materials that are less likely to absorb radiation.
* More expensive doping agents and insulators, to make sure that stray voltages go where they're supposed to in a controlled fashion.
* Extra shielding, both at the component level and the spacecraft level

Logical protections are things done in software or the design of a system to build in logical redundancy in case things do go wrong. Most of these techniques also apply to regular safety-critical systems to improve resiliency to regular failures as well.

* Use error-correcting codes and schemes. These methods use extra bits of data (such as parity bits) to indicate when something is wrong, or even provide redundancy so that a bit-flip can occur without affecting the logical outcome of a computation.

* Built-in redundancy. You can build multiple parallel systems that all do the same thing, and compare outcomes at the end of the process. For example, instead of running a program one time, you could physically load three copies of a program into memory, physically run the program three times, and then compare the outputs. The programs "vote" on the correct answer at the end of the process, so if two programs have answer A and the third program has answer B, the answer with the most votes wins. You can even build physically redundant hardware, if you have the budget for it (multiple processors, sensors, memory banks, etc.). 

* Watchdog elements. The easiest way to fix a faulty computer after a bit-flip is to reboot it. Spacecraft have built-in "watchdogs" that monitor the status of the spacecraft, and if something doesn't happen the way that it's supposed to happen then it triggers an automatic reboot of the system. The most common type here is a watchdog timer- for example the spacecraft operating system might be designed to reset a timer every 60 seconds, and if the timer ever goes off without being reset it can trigger a hard CPU interrupt that triggers a CPU reboot. You can have multiple levels of watchdogs for different systems or different levels of reboot.

There is a whole field of study that is dedicated to building resilient systems, and there are lots more techniques that may or may not be applicable to specific spacecraft. You could really go on all day.