why panic(9) ?

Chuck Swiger cswiger at mac.com
Tue Jan 11 20:34:12 UTC 2011


On Jan 11, 2011, at 12:11 PM, David DEMELIER wrote:
> 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.

You've got it backwards.  A system panic()s to avoid writing corrupted data to disk.

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

Sometimes, yes.  If it was possible for the kernel to handle an error condition without panic()ing, then that is obviously preferred-- but there are situations where there is no way for the system to recover.  Common examples of that include when the boot disk fails or disappears, or when the kernel runs out of memory in a situation where it can't get more free pages available.  Less common is when some kind of kernel invariant is violated, indicating that essential kernel data structures have been corrupted.

> 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() !

I admire your contrived example.  :-)  The data available to me suggests that Solaris boxes on enterprise-grade hardware have the highest uptimes; FreeBSD (and related platforms like NetBSD/OpenBSD/DFly/etc) are next, then MacOS X, then Linux, then Windows.

I expect anything based on Unix to be routinely capable of multi-year uptimes; some carefully chosen Windows boxes can also do that, but the widespread prevalence of security issues requiring reboots on Windows means that I don't usually see Windows boxes with uptimes of greater than a month. 

> Seriously, I really hate when I play some music that suddenly the
> music get stucked in a infinite loop, why ?

Probably a bug in the sound card driver.

> 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.

"think"?  If you don't have experience running Windows 2000 are thus are simply guessing, let me assure you that Win 2000 can and does (or did) panic due to userland software.

Regards,
-- 
-Chuck



More information about the freebsd-current mailing list