A relaxation oscillator is a type of electronic oscillator that generates a non-sinusoidal waveform, typically a square or sawtooth wave, through the periodic charging and discharging of a capacitor. It operates by alternately storing energy in an electric field and then releasing it, creating a repetitive cycle that results in oscillations. This process is often controlled by a comparator, which switches states when the voltage across the capacitor reaches specific thresholds.