...making Linux just a little more fun!
By Jim Dennis, Jason Creighton, Chris G, Karl-Heinz, and... (meet the Gang) ... the Editors of Linux Gazette... and You!
From Adam S Engel
Answered By: Thomas Adam, Rick Moen, Mike Orr
I was hunting down a "fugitive" process and accidently hit the BSD command ps aux (thinking it was an accident because I'm using Mandriva, which I thought was based on System V)
[Thomas] In terms of Init level structures then it is, yes.
and received something like this:
~ 495 --> ps aux | head -5 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 1560 476 ? S Nov30 0:00 init [5] root 2 0.0 0.0 0 0 ? SN Nov30 0:00 [ksoftirqd/0] root 3 0.0 0.0 0 0 ? S< Nov30 0:00 [events/0] root 4 0.0 0.0 0 0 ? S< Nov30 0:00 [khelper]
But then, just for the hell of it, I hit the System V command, ps -ef and got this:
~ 494 --> ps -ef | head -5 UID PID PPID C STIME TTY TIME CMD root 1 0 0 Nov30 ? 00:00:00 init [5] root 2 1 0 Nov30 ? 00:00:00 [ksoftirqd/0] root 3 1 0 Nov30 ? 00:00:00 [events/0] root 4 1 0 Nov30 ? 00:00:00 [khelper]
I thought most Linuxes, particularly the "big ones" like Fedore, Debian, SuSE, Mandriva, were based on System V.
[Thomas] They are, but the ps command is an oddity in that sense. Still useful, though.
Even so, my MacOSX, based loosely on BSD, will not accept the ps -ef command. Can a system (Mandriva in this case) be comprised of both?
[Rick] All modern Unixes (except *BSD, which are holdouts) are the result of (or inspired by) a shotgun marriage of those two cultures (plus SunOS), called System V R4, released by AT&T in 1988. Quoting from the Unix FAQ:
Even prior to that, retrofitting "BSD enhancements" onto System V-based systems was a nearly ubiquitous customisation: Sys V R4 simply acknowledged that reality, bowing to the technical community's mandate.
The general architectural description of Sys V R4 got abstracted out as the POSIX.1 specification, which served as the blueprint from much of what Torvalds and co. (and FSF, and others) then performed in building up what today we call GNU/Linux systems: Linux distributions generally are an independent implementation of (most of) the POSIX spec, which in turn was based largely on Sys V R4. And so, here we are.
The rc.init files seem, from what I recall from Redhat, to be System V.
[Sluggo] See "man ps". The 'ps' Linux uses has two sets of command-line options to please everybody. There are also verbose long options, and two sets of output formats.
Linux generally follows the System V "style" but deviates whenever it feels like it.
[Rick] And System V wasn't exactly System V, any more, after SysV R3. ;-> SysV R4 was, after all, one of computing biggest exercises in syncretism.[1]
[Jimmy] The footnote is missing, but I assume it was to contain a definition of syncretism:
Attempted union of principles or parties irreconcilably at variance with each other.
(dict.org)
[Sluggo] The network stack is closer to BSD's.
[Rick] Amen to that. Back when there was a Caldera Systems, Inc. (remember them?), they kept trying to get Torvalds to accept a huge patch to add the System V "STREAMS" interprocess I/O system. Torvalds turned them down flat, repeatedly, saying (and I paraphrase): "Why would we need that bloatware in our kernel, when Berkeley sockets already do that same job at least as well?"
[Sluggo] The init system is not part of "Linux" (the kernel) but is chosen by each distribution. Most distros use System V style, and even those that don't like Slackware have compatibility directories so that vendor-compiled commercial programs can be installed without too much hassle. However, the init strategy is one of the most varying things between distributions.
I just got a new Dell Dimension basic "cheap" no-frills computer, but still, it's 80 gigs of hard-drive space are far more than i need, so I'm installing SuSE, Mandriva, and a third. It was going to be Debian, but now I'm thinking of FreeBSD. Can anyone tell me the major difference between FreeBSD and Linux?
[Rick] Speaking in very broad terms, FreeBSD was designed and is maintained by people who never liked AT&T Unix or any of its derivatives and independent reimplementations at all, and who thus were unsatisfied by the System V R4 compromise. Of course, that's hardly all there is to it: If you'd been sued, more or less baselessly, by a Fortune 500 corporation for copyright infringement, you'd probably develop an attitude problem, too.
The difference in init scripts, you know about. A minority of Linux distributions have offered BSD init scripts, too, all along, e.g., Slackware, for those who like them.
Additionally, there are such a large number of other small but significant architectural differences that I cannot hope to remember them all.
The BSDs tend to favour a "BSD slice"-type partition map, as opposed to the IBM/Microsoft-style partition map more typical of Linux systems (at least on IA32/x86-64). Their directory layout is a bit different, not very close to the Filesystem Hierarchy Standard promoted by the Linux community. They tend to use variants on UFS as their main filesystem. (FreeBSD favours a variant called FFS = Fast Filesystem, incorporating Marshall Kirk McKusick's softupdates instead of journaling. Softupdates are a clever and effective way to get most of journaling's advantages in protecting metadata following crashes or power loss -- but sadly does nothing about the problem of long fsck times after such events.)
They tend not to have anything resembling /proc. They favour csh over Bourne variants such as bash. They favour nvi over vim. They default to use of the wheel group (which Linuxes usually lack mostly because Stallman at FSF doesn't like the concept). In general, their prejudices tend to come across to Linux users as a bit old-fogey-ish.
They offer both binary packages plus a very successful build-from-source architecture called the "ports" system. The closest thing to the latter on Linux would be Gentoo's portage and the GAR build system (and similar things in other build-from-source Linux distros).
They have their own libc (not based on GNU's, as Linux always has been) and their own implementation of make. Otherwise, a lot of the userspace toolsets are literally exactly the same (except compiled to a different ELF binary format).
Spend some time reading "The FreeBSD Handbook", online: It's a landmark in clarity for technical documentation, and worth reading on that basis alone.
I've heard that FreeBSD is known for its security and other network capabilities.
[Rick] FreeBSD is not especially known for security. (You might be thinking of OpenBSD.) I would say that it best known for scalable network performance under heavy load, and for stability. It's also known for having relatively narrow scope of hardware compatibility (i.e., driver selection), compared to Linux, and for relatively slow and conservative development: You may or may not find FreeBSD 6.0-STABLE's driver support for your new Dell Dimension's chipsets to be adequate.
Specific comparisons of FreeBSD with typical Linux systems have been done repeatedly, but tend to have the problem of being out of date (which doesn't stop people from alluding to them, out of ignorance). E.g., often-heard claims about better FreeBSD VM performance rely on Linux 2.4.x results, back when Linux had a real problem, there. For that matter, Linux's entire TCP/IP stack has been thrown out and rewritten four or five times during the kernel's history, so you can imagine the large opportunity for outdated comparisons, there.
It used to be the case that FreeBSD's SCSI subsystem gave significantly better performance than that of the Linux kernels, but I suspect that difference, too, has been eliminated. What probably does remain is the matter of NFS/autofs/amd: If you're a heavy NFS user, you'll find that FreeBSD's NFSv3 implementation still has fewer bugs than Linux's, though the gap is pretty small by now.
[Sluggo] Some people say BSD's network stack can handle a higher load.
[Rick] That's largely on the basis of data like this 1999 event: https://www.bafug.org/news/NewRecord.html
At that time, Walnut Creek CD-ROM set the world record for most bytes of network traffic processed in 24 hours by a single host: One single-processor PII box (a then-famous FreeBSD ftp server) handled 1.39 terabytes. (This burst of traffic was, ironically, occasioned by the release on that machine of Slackware 4.0.)
Fast-forward: About a year ago, I helped build what became the second-fastest computational cluster in the world, "Thunder", a set of 1024 quad-Itanium2 Linux boxes. The interconnects for node-to-node data passing used Quadrics cards, and I don't have figures handy but it was a stupendous level of network traffic.
[Sluggo] But both systems are widely used in high-performance mission-critical situations, so the difference is a bit academic. Isn't Linux being used for rocket control somewhere?
Linux comes in a wide variety of flavors from user-compiled hacker systems (Gentoo) to turnkey Windows clones (Linspire), with RPM/DEB distros in between. BSD sticks to the user-compiled route.
[Rick] Misconception. It's actually probably more common, in practice, to install software from the binary packages than to build it from ports. I can tell you that BSD admins will often resource to packages when there are local build problems, if nothing else.
[Sluggo] BSD also tends to have less support for new hardware, and last time I checked it had an incompatible disk-partitioning scheme, making dual booting a problem.
[Rick] FYI: FreeBSD (at least) is perfectly happy booting from an IBM/Microsoft-style partition table. For that matter, you can boot Linux (but not MS-Windows) from a BSD "slice"-style disklabel.
[Sluggo] But if a user-compiled distro appeals to you and you like the BSD traditions, FreeBSD would be worth looking into. That seems to be the most popular one for new users, although NetBSD and OpenBSD are also free and would be worth comparing.
[Rick] Don't overlook DragonFly BSD. https://linuxmafia.com/pipermail/conspire/2005-October/001504.html