A+ Certification / Beginners

# Understanding Error-Checking Memory

There are two primary types of error-checking memory that have been used in systems over the years. The following sections introduce you to these two types of error-checking memory.

## Parity versus non-parity

In this section you learn about parity versus non-parity memory. Parity memory is a type of error-checking memory, which is memory that verifies the information stored in memory is what is actually read from memory at a later time. Non-parity memory is simply memory that does not perform any kind of error checking to ensure that the data written to memory is what is actually read when it is retrieved. Let's look at how parity memory works! There are two types of parity memory: odd parity and even parity. Both parity methods function the same way but differ in the sense of whether they look for an odd number of bits or an even number of bits. This discussion uses odd parity as the example.

With parity memory, for every byte (8 bits) of data written to memory, there is an additional 9th bit known as the parity bit. When storing information to memory, the number of the enabled data bits (bits set to 1) written to memory are added up.

With odd parity, if an even number of data bits are enabled, the parity bit is set to 1 (enabled) so that there is an odd number of enabled bits in total written to memory. If the result of all the enabled data bits is odd, the parity bit is set to 0 (disabled) so that the odd number of enabled bits is retained. After the parity bit has been set, the byte of data and the parity bit are written to memory. Note that even parity works the same way, only it looks for an even number of enabled bits; if the number of enabled bits is odd, then the parity bit is enabled.

When the CPU requests data from memory, the data byte is retrieved along with the parity bit that was generated when the byte of information was stored in memory. The system looks at the data byte and calculates whether the parity bit stored in memory should be set to 1 or 0. It then compares the answer it has just generated with the value of the parity bit stored in memory. If the two match, the integrity of the information in memory is considered okay, the parity bit is stripped from the data byte, and the data is delivered to the CPU. If the two differ, you have a parity error, meaning that there is a problem with the integrity of the data stored in memory.

Note that parity memory cannot correct the error; it just reports that an error exists.

## ECC memory

Error-checking and correction (ECC) memory is memory that can detect data integrity problems the way that parity memory can, the difference being that ECC memory can recover from the error and attempt to fix the problem with the data being read.