Computer Science — Hamming Distance

Jake Cutter
Technology Hits
Published in
2 min readMar 30, 2022

Error checking code is useful with working in computers because often times during the read and write process or retrieval of data the CPU often misses the selected addresses. There are ways to combat the miss penalty from a CPU. One of those ways is the use of error checking codes such as Hamming Distance.

Photo by Markus Spiske on Unsplash

Hamming Distance is the minimum number of bits that are different between any two correct bit patterns. You can learn more about bits here.

Example:

011011 -> 001111

Hamming Distance = 2 bits with a one-bit error

Hit versus Miss

A hit is when the cache determines the correct address for the data. It is a miss when the address is incorrect. This can lead to miss penalties such as page faults and incorrect values.

Parity Bits

The parity bits can be either odd or even. “If the parity of the memory word and the stored parity bit do not match, an error has occurred,”(Computer Organization And Design Arm Edition). For instance, the parity bits for an even parity would be 2,4,8,16. It is to the power of two.

Citations:

Patterson, David A., and John L. Hennessy. Computer Organization and Design: The Hardware / Software Interface Arm Edition. Elsevier, 2017.

Cao, Qing. Professor. University of Tennessee. Knoxville, Tennessee. 2021

--

--