why panic(9) ?

Boris Kochergin spawk at acm.poly.edu
Tue Jan 11 21:07:52 UTC 2011

On 01/11/11 15:11, David DEMELIER wrote:
> Hello,


> I'm just guessing why current BSD panic() when a problem occurs, all
> modern operating systems solve the problem instead of crashing
> suddently and corrupting all your data without saving your work.

All modern operating systems? Maybe some niche ones, like the ones that 
run on Mars rovers, have made progress towards formal verification and 
are believed not to crash given correctly-functioning hardware. The 
latest versions of Windows, OS X, and Linux all panic.

> Yes, why this function exists? There is no way to solve a problem
> without panic'ing?

Imagine you've got a machine with bad RAM. It corrupts a pointer in the 
kernel filesystem code. Imagine there is some code in the kernel 
filesystem code that checks whether a pointer points to memory belonging 
to the kernel filesystem code before dereferencing it, and the check 
failed. What should happen? Continued execution will, at best, lead to 
flamboyant failure of kernel subsystems or userspace programs, and, at 
worst, will silently destroy or modify data in memory or on your disk. 
(By the way, this actually happens.)

> Is panic really needed? Imagine someone working on
> something really important and his computer just panic, his work not
> saved everybody shout at him in the corporation. He lose his job, his
> wife, his dog, everything is wrong, just because of a panic() !

When I do kernel work, I keep my source code on an NFS share on a 
known-stable machine so that when the machine I'm working on inevitably 
crashes, I don't lose my code. Reliability is about more than software 
choices. There are other best practices to consider.

> Seriously, I really hate when I play some music that suddenly the
> music get stucked in a infinite loop, why ? I don't know because the
> panic does not core dump. But after some search I found that the panic
> was done because of conky. How the hell conky can panic FreeBSD? We
> are in 2011 ! I think even Window 2000 does not crash on a user-land
> software.

Frustrating at it may be, there are things you can do, like compiling 
your kernel with DDB and performing online debugging.


> I'm guessing now, if minix panic when a bloated crappy software is
> running. I think Andrew is in the right way.

More information about the freebsd-current mailing list