A kernel panic is a safety measure taken by an operating system's kernel upon detecting an internal fatal error in which either it is unsafe to safely recover or continuing to run the system would have a higher risk of major data loss. It occurs when there is a low-level fatal error and the operating system's kernel is unsafe to fix it.
When a kernel pain occurs the kernel routines that handle panics are generally designed to output an error message to the console, dump an image of kernel memory to disk for post-mortem debugging, and then either wait for the system to be manually rebooted or initiate an automatic reboot.
Kernel panics can be caused by a variety of factors such as incorrectly configured or installed kernel binary images from source code, malfunctioning RAM, or add-on hardware that is incompatible with the operating system.