The Penguin, the Blowfish, and the Demon.
Tags: linux, opensource, computerscience
Published: 2020-01-04 21:50:29

If you're a developer, you have probably heard of Linux and BSD. You know that they're free, open-source operating systems, both of which you probably associate with typing similar commands into terminals, and seeing lots of white lines of text scroll by on a black background. Perhaps you tried installing Ubuntu or Arch, or had to work with Linux on a production server. Perhaps you ran some commands in your Mac Book's terminal and noticed some slight differences in the commands, or mentions of FreeBSD in its `man` pages.

While they may seem similar to the untrained eye, after spending a great deal of time using each operating system and delving into their respective communities, I learned that they are a lot different, both technically, and philosophically.

## The Similarities

Both Linux (or more accurately, GNU + Linux) and the BSDs (FreeBSD, OpenBSD, etc), are open sourced operating systems aimed at replicating the experience of UNIX, a proprietary operating system released by AT&T in the 70s.

UNIX-like operating systems are beloved by developers of all ages thanks to its timeless philosophy emphasizing simplicity and interoperability between applications. Thanks to the ease at which applications can be "piped" together in a UNIX system, developers can automate repetitive tasks and create powerful workflows for themselves and their teams.

As a result of this, Linux and the BSDs have a lot of similar commands, such as `bash`, `grep`, `cat`, `ls`, although the behaviors are slightly different for many of them, as they have different communities of programmers maintaining them.

## Modular vs Cohesive

The first difference I picked up on was that FreeBSD and OpenBSD are downloadable as complete operating systems, whereas GNU+Linux refers to a collection of small programs, including the Linux Kernel, which isn't a viable OS by itself. Because of this, almost all Linux users choose Linux Distributions or "distros", which are bundles of programs along with the kernel, viable as standalone OSes.

For example, the GNU version of the `grep` utility that comes with most Linux distros has its own [source repository](http://git.savannah.gnu.org/cgit/grep.git), whereas the FreeBSD `grep` is [part of the larger FreeBSD repo](https://github.com/freebsd/freebsd/blob/master/usr.bin/grep/grep.c).

Both approaches have advantages and disadvantages. With BSD, a bug in a program can be fixed by the developers and pushed out to all BSD users. With Linux, the developers have to create a new release of their program, which is then up to the maintainers of the distros to include. Also, if the bug is caused by an interaction of multiple different programs, it's easier to fix if all the programs are maintained by the same group.

The advantage of Linux in this regard is that it allows you to customize the system to your needs more-easily, and it allows deveopers to specialize and focus their energy on their individual projects rather than the OS as a whole.

## The License

The biggest ideological difference between the two is the license. GNU software and the Linux kernel are protected by the GPL (GNU Public License), which requires anyone who builds upon the source code to release their source and put their work under the same license.

The BSD license is much more relaxed and allows people to make changes and sell their work without releasing the source. FreeBSD 9 is used as the base for the Playstation 4's operating system, and more notoriously, Apple's iOS and MacOS devices are BSD-based.

There is a never-ending heated debate online about which of these licenses is more open and free.

## The Kernels

Both kernels are nearly identical in functionality. They're simply programs that run directly on CPUs which manage memory, processes, and abstract hardware devices into file-based APIs for user-space programs to access.

The main thing to keep in mind is that Linux has many more hands and eyes working on it to try and get as much support for different devices as possible, whereas the BSD kernels are conservative and their developers try to keep them small. From my experience, I haven't had too much difficulty getting hardware to work, but I would expect BSD to be more likely to have hardware incompatibility problems.

## The Inits

Linux' user-space init has gone through a lot of different iterations. It started with the classic Unix SystemV init, but most distros now use one called Systemd. Others exist, such as Gentoo's OpenRC and Void Linux' Runit.

BSD has been using its own ultra-minimal rc script-based init system since its inception, simply referred to as "init" or "BSD init".

## The Sound Stacks

Linux has also underwent many changes to its audio stack throughout the years. It started with OSS, the Open Sound System, but eventually moved to something called ALSA (Advanced Linux Sound Architecture), which is usually used with Pulseaudio, a user-space sound server that wraps it. Audio on Linux has a lot of memes surrounding it because of how complicated it can be to get it working. Many Linux users miss the OSS days and resent ALSA.

The BSD developers' conservative philosophy has led to them keeping OSS, which is still the sound system used in modern BSD.