What is a kernel panic?

topic posted Sun, June 10, 2007 - 12:20 AM by  Jory
Your computer runs applications like Mail, Firefox, Photoshop, etc. These are all programs. Your computer runs one program at its heart called the kernel, which in essence is the supervisor that runs the other programs. You might wonder why a supervisor is needed. The various programs are all essentially running at the same time. And, sometimes they need access to shared resources, like your disk drive, memory, the screen. Even devices like your dvd/cd drive or a thumb drive. But, all these things are essentially only able to talk to one program at a time. So, the supervisor program is the ambassador to all of those shared resources on behalf of the various programs running on your computer.

A kernel panic simply means that the supervisor program has encountered an error that it cannot resolve, and it has chosen to quit rather than proceed. It is easy to say "why not just ignore the error and go on." I think it is safe to say that for the most part, the folks who implemented the kernel do have it proceed whenever possible, and that when it does choose to quit, it is because there is no other choice that is better. Worse choices include ruining data on your hard drive, etc.

I've encountered kernel panics mostly when my computer had a hardware problem. I had a laptop with a cracked motherboard. I could repeatably and reliably cause a kernel panic by applying slight pressure to opposite corners of the laptop. I had a tower that would get a kernel panic whenever I started doing a lot of work (quite frustrating). Turns out one of the processors was overly sensitive to heat and would fail when the machine got too hot, which only happened when I was doing a lot of work. In both cases the hardware repair eliminated the kernel panics.

It is also possible to get a kernel panic because of a software problem. This would most likely be a software problem in the kernel itself. After all, any program can have bugs, and complicated programs more so. And, the kernel is a very complicated program, as you might imagine. But, it is pretty damn stable, all things considered. Less often, an application can cause a kernel panic. This is more rare precisely because the kernel is written in a fairly defensive manner, expecting applications to make mistakes and do foolish things; however, fools know no limits and are ingenious in their foolishness. So, there can be no perfect defense.

I guess one analogy in real life is that sometimes your supervisor has a bad day because of something happening at your job, or because of something you or one of your peers has done. And, he wigs out, shouts at everyone and disappears into his office and locks the door for a while. Work stops for a while while everyone gets their head together, and then things pick up again and work continues. The supervisor comes out of his office, apologizes (if they're a reasonable person) or says something cryptic you don't really "get" to explain their behavior, and gets on with life. That's a kernel panic in the real world.
posted by:
Jory
SF Bay Area