Once your main power fails, you will need emergency power source from a special device called an Uninterruptible Power Supply (UPS). For low-power users, batteries and relevant electronic circuitry are utilized to obtain near-instantaneous protection. However, diesel generators are commonly used for high power users.
Although the UPS runtime lasts for minutes, this amount of time is long enough to enable an auxiliary power source to provide stable power supply online, as well as to give enough time for a protected piece of equipment to shut down. There are different sizes available for UPS units such as larger ones for powering cities and data centers and smaller ones that protect one computer without any video monitors.