How power supplies work
Switching power supplies may be far more complex than linear power supplies, yet they are much more common nowadays and irreplaceable when it comes to high power equipment. Even though their design is much more complex than that of linear power supplies, their fundamental difference is that there are two rectification stages instead of one. This extra rectification stage makes their design much more complicated but at the same time their advantage in terms of size, weight and efficiency is nothing short of enormous.
Computer ATX Switching PSU
If one understands how a simple linear power supply works, then the operation principle of a switching power supply should not be hard to understand; nonetheless, it is a more complex design than that of linear power supplies. Switching power supplies will not step down the AC voltage of the utility power grid; they will rectify it to DC voltage directly and then a switching transistor will invert it to AC voltage again but at a frequency thousands of times higher than that of the AC power grid. The frequency of the power grid is 50Hz to 60Hz, depending on where on the planet you live in, and that is what linear power supplies use; typical switching power supplies change the transformer input frequency to anything between 100.000Hz and 2.000.000Hz. Then they will again rectify that high frequency AC voltage (or portion of it) to DC voltage of a desired value.
Fundamental SMPS schematic
The higher the input frequency is, the smaller the primary electrolytic capacitor and the main transformer can be; a switching power supply is anywhere between 4 and 25 times smaller than a linear power supply of similar output specifications and much lighter at the same time. The controllable high switching frequency of the transistor can also increase the electrical efficiency of the power supply dramatically by reducing the duty cycle to match the load's power demands, meaning that it can cut off portion of the input power and supply only the amount of power the load requires. This approach is called pulse width modulation (PWM) and can easily double the power supply's efficiency; typical switching power supplies have an electrical efficiency of 75% or better.
230W ATX PSU schematic by SevenTeam (greatly outdated)
Switching power supplies are not without disadvantages, which are many and critical. Remedying these disadvantages requires additional circuits (such as PFC controls, voltage regulation, etc) which further increases their cost and complexity. The high switching frequency of the main transistor is a serious source of electromagnetic interference (EMI) which needs to be suppressed by using filters and shielding. It also causes a lot of electrical noise at the output, therefore using line filters is necessary to ensure the smooth operation of digital circuits and the noiseless operation of audio systems. Low quality products can cause similar noise back towards the input, interfering with other AC equipment connected on the same power line. Products without power factor correction will draw a lot of reactive power which is not used by the power supply but causes strain on the power lines and other electrical equipment, as well as making the power supply the source of strong harmonic distortions; this is why non-PFC corrected power supplies became prohibited by law in many countries. The output voltage quality is actually worse than that of the linear power supplies, usually requiring the presence of voltage regulation circuits in order to reduce the voltage ripple enough to meet certain specifications.
Switching power supplies also require a great in-rush current when they are turned on, meaning that momentarily they will draw an immense amount of power which can be disastrous to the utility power grid and electrical equipment, therefore yet another circuit is needed to limit that effect. Finally, switching power supplies are less reliable by design; for example, a failure could cause a dramatic increase of the output voltage, damaging any connected equipment, or stress on the capacitors could cause them to explode, requiring careful designing and testing. To combat these problems high quality power supplies integrate even more circuits, such as OCP (over current protection) and OVP (over voltage protection), making them even more complex and expensive.
300W ATX PSU with PFC schematic by InWin
Switching power supplies have a serious number of issues and their immense complexity makes designing and troubleshooting extremely difficult. Nevertheless, their much smaller size, much less weight and their high electrical efficiency makes the use of them into virtually all equipment a necessity. All computer power supplies of the past several decades are switching power supply designs, much like the power supplies of almost all consumer electronic equipment ever made.