# Guide to Unix/BSD/FreeBSD

| $_ | Wikibooks Guide to Unix Computing | Edit template |
   General: Introduction | Explanations | Why Unix-like Platforms: Linux | BSD Quick Reference: Commands | Environment Variables | Files | License
   General: Introduction | External Links Distributions: FreeBSD | Mac OS X | NetBSD | OpenBSD | Historical

## Background

FreeBSD is a Unix-like free operating system descended from AT&T UNIX via the Berkeley Software Distribution (BSD) branch through the 386BSD and 4.4BSD operating systems. It runs on processors compatible with the Intel x86 family, as well as on the DEC Alpha, the UltraSPARC processors by Sun Microsystems, the Itanium (IA-64), AMD64 and PowerPC processors. It also runs on the PC-98 architecture. Support for the ARM and MIPS architectures is currently in development.
FreeBSD is developed as a complete operating system. The kernel, device drivers and all of the userland utilities, such as the shell, are held in the same source code revision tracking tree (CVS). This is in contrast to Linux, a similar but better-known operating system, in which the kernel is developed by one set of developers; userland utilities and applications by others, such as the GNU project; and all are packaged together by other groups and published as Linux distributions.
As an operating system, FreeBSD is generally regarded as quite reliable and robust, and of the operating systems that accurately report uptime remotely [1], FreeBSD is the most common free operating system listed in Netcraft's list [2] of the 50 web servers with the longest uptime (uptime on some operating systems such as some versions of Linux can't be calculated). A long uptime also indicates that no kernel updates have been deemed necessary, as installing a new kernel requires a reboot and resets the uptime counter of the system.

### History and development

Initial development of FreeBSD started in 1993, taking its sources from 386BSD. However, due to concerns about the legality of all the sources used in 386BSD and a consequent lawsuit between Novell (then owner of the UNIX trademark) and Berkeley, FreeBSD ended up re-engineering much of the system with the FreeBSD 2.0 release in January of 1995 using the 4.4BSD-Lite release from the University of California, Berkeley. The FreeBSD Handbook includes more historical information about the genesis of FreeBSD.
Perhaps FreeBSD 2.0's most notable advance was the revamp of the original CMU's Mach Virtual Memory system, which was optimized for performance under high loads, and the creation of the ports system that made downloading, building and installing third party software very easy. FreeBSD powered extremely successful sites like cdrom.com (a huge repository of software that broke several throughput records on the net), Hotmail, and Yahoo!.
FreeBSD 3.0 brought many changes: it switched to the ELF binary format, initial support for SMP systems and also added support for a new 64 bit platform: the Alpha. At its time the 3.X branch was severely criticized as many changes were not evidently beneficial and affected performance, but it was a necessary step to develop what would become the very successful 4.X branch.
Initially, FreeBSD employed the BSD Daemon as its logo, but in 2005 a competition for a new logo was arranged. On October 8, 2005, the competition finished and the design by Anton K. Gural was chosen as the new FreeBSD logo. The BSD Daemon will remain as the FreeBSD Project mascot. [edit]

### FreeBSD 5 development and changes

The latest and final FreeBSD release from the 5-STABLE branch is 5.5, and was released in May 2006. FreeBSD developers maintain (at least) two branches of simultaneous development. A -STABLE branch of FreeBSD is created for each major version number, from which releases are cut about once every 4-6 months. The latest 4-STABLE release of FreeBSD is 4.11, which is the last of the 4-STABLE branch releases. The first 5-STABLE release was 5.3 (5.0 through 5.2.1 were cut from -CURRENT). The first 6-STABLE release was 6.0. The development branch, -CURRENT, is now 7.0-CURRENT, which contains aggressive new kernel and userspace features. If a feature is sufficiently stable and mature, it is eventually backported ("MFC" - Merge from CURRENT in the FreeBSD developer slang) to the -STABLE branch. FreeBSD's development model is described in an in-depth article by Niklas Saers [3].
The big difference in FreeBSD 5 was a major change in the low-level kernel locking mechanisms to enable better symmetric multiprocessor (SMP) support, releasing much of the kernel from the MP lock, sometimes referred to as the Big Giant Lock. It is now possible for more than one process to execute in kernel mode at the same time.
Other major changes include an m:n threading solution called KSE which is now the default threading (pthreads) library, starting with 5.3 (the creation of the 5-STABLE branch). The terminology m:n, where m and n are small positive integers, implies that m userland threads correspond to n kernel threads. Many other new features are security related. The TrustedBSD project was formed by Robert Watson for the express purpose of adding trusted operating system functionality to the FreeBSD operating system. An extensible mandatory access control framework (the TrustedBSD MAC Framework), filesystem Access Control Lists (ACLs), and the new UFS2 filesystem all came from TrustedBSD. Some of the TrustedBSD functionality has been integrated into the NetBSD and OpenBSD operating systems as well.
FreeBSD 5 has also significantly changed the block I/O layer with the introduction of the GEOM modular disk I/O request transformation framework, contributed by Poul-Henning Kamp. GEOM enables the simple creation of many kinds of functionality, such as mirroring (gmirror) and encryption (gbde). The recent release of FreeBSD 5.4 has confirmed the FreeBSD 5.x branch as a highly stable and well-performing release, albeit one with a long gestation period due to the large feature set.

### FreeBSD 6 and 7

FreeBSD 6.1 was released on May 8, 2006, and 7.0-CURRENT is under active development. These versions continue the work on SMP and threading optimization, as well as additional work in the area of advanced 802.11 functionality, and TrustedBSD security event auditing. The primary release accomplishments of this release include the removal of the Giant lock from VFS, replacement of the libthr library with a better performing implementation of 1:1 threading, and the addition of a BSM audit implementation, called OpenBSM, created by the TrustedBSD Project which is heavily based upon the BSM implementation found in Apple's Open Source Darwin which has been released under a BSD-style license.

### Linux compatibility

FreeBSD provides binary compatibility with several other Unix-like operating systems, including Linux. The reasoning behind this is generally attributed to being able to run applications developed for Linux, often commercial, that are only distributed in binary form and thus cannot be ported to FreeBSD without the will of those who control the source code.
In a nutshell, it allows FreeBSD users to run a majority of the applications that are only distributed as Linux binaries. When compared to the vast number of native applications available for FreeBSD using the Ports Collection, these applications are in the minority. Applications used under the Linux compatibility layer include StarOffice, the Linux version of Netscape, Adobe Acrobat, RealPlayer, VMware, Oracle, WordPerfect, Skype, Doom 3, Quake 4, the Unreal Tournament series, SeaMonkey, and so on. Generally, there seems to be no noticeable performance penalty when running Linux binaries as opposed to native FreeBSD ones.
Though there are many applications that run flawlessly under the compatibility layer, it should be noted that the layer is not complete, thus rendering some Linux binaries unusable on FreeBSD or limiting their functionality, possibly because this compatibility layer only supports the system calls of Linux Kernel 2.4.2, a historic release. One example of this is Cedega, TransGaming's product to run Microsoft Windows games on Linux. Its usage is largely crippled at this time due to an incomplete compatibility layer. There has, however, been limited success in using it to run games on FreeBSD [4]. A 2006 Summer of Code project to update the compatibility layer and implement missing system calls has been accepted [5].
For most scientific applications, the Linux compatibility layer performs correctly; applications such as nmrpipe, ccp, Mathematica and Matlab perform as expected.

### License

As with its sister operating systems, the code in FreeBSD is released under the terms of a variety of licenses. All of the kernel code and most newly created code is released under the terms of the two-clause BSD license, which allows everyone to use and redistribute FreeBSD as they wish. There are also parts under the GPL, LGPL, ISC, three-clause BSD license, and four-clause BSD license.
Also available are binary blobs for particular functionality, such as the Atheros HAL for wireless functionality and a binary only tool for Adaptec's AAC RAID.

### Derivatives

A range of products are directly or indirectly based on FreeBSD. These range from embedded devices, such as Juniper routers and Nokia's firewall operating system, to portions of other operating systems including Linux and the RTOS VxWorks. Darwin, the core of Apple's Mac OS X, borrows heavily from FreeBSD, including its virtual file system, network stack and components of its userspace. Apple continues to integrate new code from and contribute changes back to FreeBSD. The open source OpenDarwin, originally derived from Apple's codebase but now a separate entity, also includes substantial FreeBSD code. In addition, there are a number of operating systems originally forked from or based on FreeBSD including PC-BSD and DesktopBSD, which include enhancements aimed at home users and workstations; the FreeSBIE and Frenzy live CD distributions; the m0n0wall and pfSense embedded firewalls; and DragonFly BSD, a notable fork from FreeBSD 4.8 aiming for a different multiprocessor synchronization strategy than that chosen for FreeBSD 5 and development of some microkernel features.