FreeBSD for Linux users
Nik Clayton
<nik@FreeBSD.org>, <nik@crf-consulting.co.uk>, <nik@slashdot.org>

FreeBSD in a nutshell
Freely available Unix-like operating system
Runs on IA-32 and Alpha architectures
1000’s of software packages available
Many commercial users
Thousands of developers around the world contributing to it
Used as an operating systems research platform
So far, so Linux...

FreeBSD History
BSD developed at University of California, Berkeley, as alterations to AT&T Unix
Initial implementation of key Unix concepts, such as sockets, virtual memory, and TCP/IP
386BSD developed to implement BSD Unix on x86 architecture in early 1990s
FreeBSD developed from 386BSD project (as did NetBSD)
Now has 250+ active developers, and 1,000's of contributors

Places you’ll find FreeBSD
Powering websites
Yahoo
VA Linux / OSDN / Slashdot
Netcraft
“Grunt work”
Disney
Manex VFX
NASA
ISPs
UUNet, Pair, Demon, EasyNet, …
Embedded Systems
IBM
Intel
Nokia
Checkpoint
Juniper Networks
Coyote
Other operating systems
Mac OS X

Mailing list traffic

Mailing List Subscribers

Differences to Linux

FreeBSD Licensing Model
FreeBSD distributed under "2 clause" BSD license
Copyright © [year] [name]
All rights reserved
Redistribution in source and binary forms, with or without modification, are permitted, provided that the following conditions are met:

1. Redistribution of source code must retain the above copyright notice, this list of conditions, and the disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED LIMITED WARANTIES...

FreeBSD Licensing Model
Don't claim that you wrote the code
Don't blame us if the code doesn't work
Apart from that, do anything you want with the code

The GPL and BSD Licenses
The GPL mandates that source code be disclosed
The BSD License allows source code changes to be kept secret
GPL is often categorised as "Copyleft", as distinct from "Copyright"
BSD License is "Copycentre".  We actively encourage third parties to use the source code.
Donating changes back is purely at the discretion of the party making the changes

Source Code Control
The entire source code for FreeBSD  is stored in a CVS repository
The logs, and individual changes for each file can be traced back to 1994.
The source tree can be checked out at any state, or corresponding to any release
CDs are available taking the history back a further 20 years

Source Code Control
Changes to the FreeBSD tree are available in a number of ways (CVS, CVSup, CTM (e-mail), Web)
It is possible to maintain a local mirror of the complete CVS tree
You can 'tag' a local copy of the tree as buildable, and then selectively include changes from FreeBSD

Source Code Distribution
FreeBSD Source Code
Available on CD
Can be downloaded from ftp.freebsd.org
Changes to the source code
Can be updated using CVS
Can be updated using CVSup (faster CVS)
Changes can be automatically e-mailed in, and integrated with your local source tree
Can be browsed, with history, on the web, at http://www.freebsd.org/cgi/cvsweb.cgi

Development Organisation
Two layers of FreeBSD organisation
The committers, and everyone else
Committers have write access to the source tree
Everyone else submits patches or bug reports using FreeBSD's problem reporting system, and waits for a committer to commit the change
Individuals who submit many patches (that work) are invited to become committers
9 committers form the elected "core team", for dispute resolution

Development Organisation

FreeBSD is a complete OS
FreeBSD consists of all the components needed for a complete operating system
kernel
compiler
include files
libraries
user-land utilities
Kernel and userland are kept synchronised, and can be built, from source, as a unit

FreeBSD Release Model
FreeBSD releases maintained using CVS branches
Head of the tree (-current) will become FreeBSD 5.0
Last major release (4.0) was branched (-stable)
Subsequent minor releases (4.1, 4.2, etc) consist of bug fixes backported from -current, and new features in -current that have been extensively tested
Everyone has complete access to the source code at all times, so incremental releases are not a "Flag day"

FreeBSD Release Model

FreeBSD Release Model

FreeBSD Release Model

Third Party Packages
FreeBSD has 5,200+ applications available as binary packages
Linux has similar number of applications available in a number of different binary formats (RPM, Deb, and others, depending on the distribution).
Packages are built from the “ports tree” of which more later
FreeBSD and Linux roughly equal in this respect...

Ports Tree Growth

Linux Compatability
FreeBSD runs 95%+ of Linux binary applications unchanged
Oracle
VMWare
Netscape
RealPlayer
Flash
NetBackup
Quake III

FreeBSD for Development
The source code is a great reference
Run standard development tools
gcc
gdb
ddd
(x)emacs
make

FreeBSD on the Desktop
GNOME
KDE
StarOffice
Netscape
WordPerfect
VMWare
GIMP
XMMS
CD recording
MP3 ripping
Gnutella / Napster
Afterstep / Enlightenment / Sawfish / BlackBox / IceWM …

FreeBSD Technologies

"The Build System"
The Build System
The Ports System
System Configuration
Linux Compatability
Filesystem Research
… and more

The Build System

The Ports System

System Configuration

Linux Compatability

Running a FreeBSD binary
Code like
fd = open(“/etc/passwd”, O_RDONLY);
Becomes
syscall(5, ...)
Kernel knows it’s a FreeBSD binary, uses freebsd_syscalls[] array
freebsd_syscalls[5] = freebsd_open(…);
File is opened

Running a Linux binary
Code like
fd = open(“/etc/passwd”, O_RDONLY);
Becomes
syscall(5, ...)
Kernel knows it’s a Linux binary, uses linux_syscalls[] array
linux_syscalls[5] = linux_open(…);
File is opened
All Linux file operations redirected to /compat/linux first

Running Linux binaries
No slowdown; this is not emulation
Efficiency of TCP/IP and VM system means some Linux apps run faster
SCO (ibcs2) compatibility handled in the same way

Filesystem Research

Softupdates
Three traditional file system mount types:
Asynchronous data and meta-data writes (Linux default).  Very fast, but unsafe
Asynchronous data, synchronous meta-data writes (FreeBSD default).  Slower, but safer
Journaling. Can be very fast, but the code is complicated.
Softupdates is a mechanism for ordering meta-data writes
All the speed of (1), with the safety of (2)
Softupdates and journalling have different results on different data sets

Snapshots
Take a coherent “snapshot” of a filesystem state
Filesystem activity continues, snapshot is unaffected
Space efficient; additional writes stored as “deltas” to the snapshot
Can then
Dump the snapshot to tape without affecting running applications
Use the snapshot for an instant restore
Mount the snapshot somewhere else
Migrate the snapshot to another server

Software RAID
ccd
“Concatenated Disk Driver”
Supports striping only
Vinum
From “In vino veritas”
RAID 0, 1, 5 functionality
RAIDFrame
Recently introduced
Developed at Carnegie Mellon Parallel Data Laboratory
Many hardware RAID cards (including IDE) also supported

Growfs, dirpref, hashing
Growfs
Increase/shrink an existing filesystem
E.g., add a disk, configure the RAID array, grow existing filesystems to use space
Dirpref
More intelligent layout of disk structure for increased speed on wide, deep, sparse directory trees
Hashing
Much better performance on directories with more than 10,000 files

And there’s more
Porting to IA-64 (Intel), and x86-64 (AMD) underway
FreeBSD already 64bit clean, thanks to the Alpha port
Currently boots
PowerPC and Sparc ports
The next generation of SMP support
Scaling to 64 processors and beyond
IPv6, and the next generation of networking technology
Security, gigabit and terabit networking