How does a computer unset a bit (set it from 1 to 0) in memory/storage?

It depends on the particular kind of storage.

In magnetic storage, like a spinning-disk hard drive, it magnetizes the region storing the bit in the opposite direction.  (In practice, hard drives write entire blocks at a time, but the technology could theoretically be managed a bit at a time.)

In typical flash storage, like in solid-state drives or external flash drives, it can’t write a single bit at a time. In order to change a bit from a 1 to a 0, it erases an entire block of memory, then rewrites the new data into it.

In DRAM, which is the typical kind of RAM in a computer, it connects the capacitor holding the bit to a current drain, which allows it to discharge.  (Similarly to others, standard DRAM actually can only write a whole line at a time, so switching a single bit means writing the previous value into all the other bits.)

In SRAM, which is typically used for things like on-CPU caches, the bit line is set to 0 and then the write line is set to 1.  The transistors switch into the alternative configuration, and then the write line is set back to 0, which causes them to maintain their current configuration until written again.

Leave a Reply

Your email address will not be published. Required fields are marked *